Can't connect to Wufoo API from PHP (localhost), but can connect using terminal curl OK Can't connect to Wufoo API from PHP (localhost), but can connect using terminal curl OK curl curl

Can't connect to Wufoo API from PHP (localhost), but can connect using terminal curl OK


Remove curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); from your code. As per curl document:

CURLAUTH_ANYThis is a convenience macro that sets all bits and thus makes libcurl pick any it finds suitable. libcurl will automatically select the one it finds most secure.

If you use curl_setopt($curl, CURLOPT_VERBOSE, true); in your code then you'll see that it is not sending the basic authentication in header. But if you remove that line as I've mentioned, you'll see it is working.

You can also run your curl command using -v option. It will show you the debug prints. It will help you to match the request headers of your commandline and code.