Xml with file_get_contents
Hi,
please help me why this $url does not work with file_get_contents
Code:
<?php
include("connx.php");
$id = $_GET['id'];
$id = (int) $id;
$sql = "SELECT * FROM tbl_table WHERE id='$id'";
$res = mysql_query($sql);
$row = mysql_fetch_row($res);
$url = $row[2];
$cont = file_get_contents($url);
echo '<xmp>' . $cont . '</xmp>';
?>
the URL is something like
Code:
http://site.com/xml/student_name=name&fathername=father
and this is very long URL
Re: Xml with file_get_contents
Always read the notes in the PHP manual when you use a function you haven't used before.
Quote:
Originally Posted by PHP.net Reference: file_get_contents
A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename. See the List of Supported Protocols/Wrappers for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.
Quote:
Originally Posted by PHP.net Reference: Runtime Configuration
allow_url_fopen boolean
This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers.
Note: This setting can only be set in php.ini due to security reasons.
If I'm not mistaken Safe Mode affects this setting. Disabling it should allow the code to execute properly.
Re: Xml with file_get_contents
still does not work. i have seen all these values in phpinfo and they all are enable
Re: Xml with file_get_contents
post the actual URL you're trying to open.