Page 1 of 1

How do I get the http status code?

Posted: Thu Aug 24, 2023 3:27 am
by jasanchez
Maybe this is something already answered, sorry if so.
I just need to know how to always get the status code returned by the server.

Is it with http_header() or with http_error()?

TIA

Re: How do I get the http status code?

Posted: Fri Aug 25, 2023 1:36 am
by Scott Klement
You can receive it by passing the appropriate parameter to http_error.

Or, you can just receive it as the return value from http_req, http_url_post_xxx, http_url_get_xxx, etc. They return any response code EXCEPT 200 -- instead of 200 they return 1 instead... so you can just say "if code=1; eval code=200; endif" or whatever, and you'll have the return code.