Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Detecting file_get_contents errors
Old 06-16-2009, 04:45 PM Detecting file_get_contents errors
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
HI

Im collecting some content using file_get_contents from urls and in some cases the file im trying to collect doesnt exist. The script im using is below

$reposurl = file_get_contents('http://eprints.kingston.ac.uk/view/divisions/'.strtolower($group_shortname).'.include');

But when the file doesnt exist, i get the below error.

file_get_contents(http://eprints.kingston.ac.uk/view/d...s/cwlr.include) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\xampp\htdocs\business\researchgroup.php on line 294

How do i check file exists or run this script so as i do not get the error on my page.


Thanks
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 06-16-2009, 04:58 PM Re: Detecting file_get_contents errors
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
you can use a suppressor on the function @

PHP Code:
 $reposurl = @file_get_contents('http://eprints.kingston.ac.uk/view/divisions/'.strtolower($group_shortname).'.include'); 
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
Reply With Quote
View Public Profile
 
Old 06-16-2009, 05:02 PM Re: Detecting file_get_contents errors
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
Yur that works a treat. Thanks very much.
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Reply     « Reply to Detecting file_get_contents errors
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25026 seconds with 12 queries