php error handling

Discussion in 'PHP' started by BAM78, Feb 20, 2009.

  1. #1
    how do i stop this message from appearing when my script can't reach the url?

    Warning: file_get_contents(http://www.test.com) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 OK in /home/www/test.php







    I want it to stop displaying the $url if there is an error reaching it
     
    BAM78, Feb 20, 2009 IP
  2. the-webber

    the-webber Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if you append an "@" symbol before a php function, you should suppress the error. for instance, if the error is from teh file_get_contents line then just replace that line up above with
     
    the-webber, Feb 20, 2009 IP
  3. BAM78

    BAM78 Peon

    Messages:
    115
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks! worked :)
     
    BAM78, Feb 20, 2009 IP