Page 1 of 1

file_get_contents() question

Posted: Wed Nov 17, 2010 1:57 pm
by OneEyedJack
This line works fine for me when I read the contents of the URL into a string

Code: Select all

$fname = file_get_contents('http://www.mydomain.com/ci/ci.php?/ch/b/02/972/L/0/M/0/1/972');
This one, which tries to add flexibility of changing some parameters yields the error below it.

Code: Select all

$modid = 972;
$filetoget = "'http://www.mydomain.com/ci/ci.php?/ch/b/02/" .$modid ."/L/0/M/0/1/" .$modid ."'";
$fname = file_get_contents($filetoget);
Error:
A PHP Error was encountered

Severity: Warning

Message: file_get_contents('http://www.mydomain.com/ci/ci.php?/ch/b ... /M/0/1/972') [function.file-get-contents]: failed to open stream: Permission denied
Am I missing something obvious.? The function seems to be interpreting the $fname variable correctly.

Jackl

Re: file_get_contents() question

Posted: Wed Nov 17, 2010 2:18 pm
by AbraCadaver
Get rid of the single quotes, what's that about?

Re: file_get_contents() question

Posted: Wed Nov 17, 2010 2:36 pm
by OneEyedJack
A PHP Error was encountered

Severity: Warning

Message: file_get_contents(http://www.mydomain.com/ci/ci.php?/ch/b ... /M/0/1/972) [function.file-get-contents]: failed to open stream: Permission denied
Losing the quotes simply results in the same error message except without the quotes.

Jack