Do you have any PHP / cURL examples?

I have created a simple php script which should read the list of devices with PHP and cURL.

For some reason, the request always fails and the result is “HTTP Status 401 - Bad credentials”. However, the username and the password should be correct, because I can use them successfully with the browser.

It is obvious that there is some kind of trivial error in the script, but I just cannot find it.

Do you have any PHP / cURL examples?

This seems to work fine for me:

curl -u username:password

Can you show what you are trying?