Reputation: 6081
I have a php file in the same directory as the one I am using. I need to one I am using to read from the other one.
I have this code:
$checkpass=fopen("lcp.php?pass=xxx","r");
It gives me an error saying that the file does not exist. But it does.
However, if I remove the get parameters
$checkpass=fopen("lcp.php","r");
It, works fine.
Upvotes: 1
Views: 91
Reputation:
By default fopen()
opens a file in the local file system. You can't use a query string with it because the local system will treat that as part of the file name. Were you to open the file this way you'd read the contents of it, not the output.
You can use fopen('http://lcp.php?pass=xxx','r')
if your installation of PHP is configured to allow it*. That will cause PHP to make an HTTP call to the file, so you can use a query string, and you'll receive the output of the script.
* You need allow_url_fopen
set to 1
in php.ini
Upvotes: 2