PHP Returning a HTTP error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BWGames

    PHP Returning a HTTP error

    Hi,

    I have a application that is accessing a php script via HTTP, and I will
    need the script to return anything other than HTTP 200 OK, using PHP
    occasionally.

    What code can I use to make a HTTP error returned?

    Thanks,

    Ben
    --
    BWGames
    to email change de.news to de-news
  • Ashmodai

    #2
    Re: PHP Returning a HTTP error

    BWGames scribbled something along the lines of:
    [color=blue]
    > Hi,
    >
    > I have a application that is accessing a php script via HTTP, and I will
    > need the script to return anything other than HTTP 200 OK, using PHP
    > occasionally.
    >
    > What code can I use to make a HTTP error returned?
    >
    > Thanks,
    >
    > Ben[/color]



    The header() function does pretty much what you want. Just find the
    right header to send. For some real life examples, get a browser that
    lets you look at the headers it receives and look at the log when
    encountering exactly that error.

    Note that you need to "fake" the error documents still, even if you send
    the right header. MSIE might show the "friendly" MSIE-error pages
    instead if the setting has not been deactivated, but most other browsers
    will show what the server sends.

    Take a look at the error documents that come with the server software
    and just copy the markup to the php file.

    --
    Alan Plum, WAD/WD, Mushroom Cloud Productions

    Comment

    Working...