Skip to content
Advertisement

How return http_code 401 with PHP

I’m using cUrl in the client side.

On my webservice (ws.php), i’ve this simple code :

JavaScript

When i call this ws.php page, i still have http_code = 200.

Here is my cUrl code is client side :

JavaScript

$code = 200 even i put the header code “401”.

Advertisement

Answer

try this on your ws.php:

JavaScript

Let me know if this works or not ?

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement