Jump to content

File_get_contents


skaterdav85

Recommended Posts

How do i get my output to hide these warnings and notices?

Notice: file_get_contents() [function.file-get-contents]: Unable to find the wrapper "fhttp" - did you forget to enable it when you configured PHP? in /Applications/MAMP/htdocs/php_practice/test.php on line 4Warning: file_get_contents(fhttp://twitter.com/statuses/user_timeline.xml?screen_name=StudentSurvivor&count=2) [function.file-get-contents]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/php_practice/test.php on line 4
i purposely messed up $twitter_request as you can see with the 'f' before the 'http://'. The code runs correctly, but displays all these warnings.
<?php$twitter_request = "fhttp://twitter./statuses/user_timeline.xml?screen_name=StudentSurvivor&count=2";if(file_get_contents($twitter_request) == FALSE) {	echo 'error';	}else {	echo 'success';}  ?>

Link to comment
Share on other sites

You can use the error_reporting() function to change the level of error reporting at runtime... but you're not really going to leave the code like that when you release it, are you?

Link to comment
Share on other sites

well my original code was to make a rest web web service call to display the tweets for this one twitter account. However, I noticed sometimes, not often though, it wont work, and I'll get warnings. Maybe it's because I was refreshing too much. I guess I could just suppress the errors with @, but ideally I would like to do some kind of error handling so that if an error/warning is detected, the only thing echoed out for this section of the page would be something like "Error connecting to Twitter". Any ideas?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...