hankknight
asked on
fopen opening remote files but not local ones
Hello.
I am trying to use fopen to open a local file.
$fp = fopen("/home/mysite/public _html/page s/test.php ", 'r');
does not work
$fp = fopen("/home/mysite/public _html/page s/test.php ", 'r');
does not work either
But, if I put it as a web address it works:
$fp = fopen("http://www.mysite.com/pages/test.php", 'r');
How can I get this to open my local file without having to use http?
Here is my code.
Thanks!
<?php
$fp = fopen("http://www.mysite.com/pages/test.php", 'r');
if (stream_set_timeout($fp, 15) == false){
echo "Error: Could Not Connect";
fclose($fp);
}
elseif (!$fp){
echo "Error: Could Not Connect";
fclose($fp);
}
else{
@fgets($fp);
fclose($fp);
}
?>
I am trying to use fopen to open a local file.
$fp = fopen("/home/mysite/public
does not work
$fp = fopen("/home/mysite/public
does not work either
But, if I put it as a web address it works:
$fp = fopen("http://www.mysite.com/pages/test.php", 'r');
How can I get this to open my local file without having to use http?
Here is my code.
Thanks!
<?php
$fp = fopen("http://www.mysite.com/pages/test.php", 'r');
if (stream_set_timeout($fp, 15) == false){
echo "Error: Could Not Connect";
fclose($fp);
}
elseif (!$fp){
echo "Error: Could Not Connect";
fclose($fp);
}
else{
@fgets($fp);
fclose($fp);
}
?>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER