file_get_contents issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thetribster
Forum Newbie
Posts: 7
Joined: Thu May 14, 2009 11:07 am

file_get_contents issue

Post by thetribster »

I am trying to execute the following code:

Code: Select all

 
$capture = file_get_contents('http://'.$channels['hostname_'.$page].$channels['pathholder_'.$page]);
 
but am getting the following error:

[08-Jun-2009 15:49:35] PHP Warning: file_get_contents(http://www.stratalighting.com/tw2.php?p ... 722:aplusk) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /Applications/MAMP/htdocs/IW/IW.php on line 179

This doesn't happen for all calls , only certain ones - like this one. The actual parameter is the following:

$cature = file_get_contents("http://www.stratalighting.com/tw2.php?p ... 722:aplusk");

Any ideas?
jmyeom
Forum Newbie
Posts: 8
Joined: Mon Jun 08, 2009 11:30 am

Re: file_get_contents issue

Post by jmyeom »

not tested... but i use readfile("file), ?
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: file_get_contents issue

Post by mikemike »

The function is working fine. The URL that you're trying to call does not exist on the server so file_get_contents is being given a 404. Visit the URL yourself in your browser and see.
Post Reply