How to set the authorization header using cURL See part 6. HTTP Authentication HTTP Authentication HTTP Authentication is the ability to tell the server your username and password so that it can verify that you’re allowed to do the request you’re doing. The Basic authentication used in HTTP (which is the type curl uses by default) is plain text based, which means … Read more

Set cURL to use local virtual hosts

Actually, curl has an option explicitly for this: –resolve Instead of curl -H ‘Host:’ use curl –resolve ‘′ What’s the difference, you ask? Among others, this works with HTTPS. Assuming your local server has a certificate for, the first example above will fail because the certificate doesn’t match the … Read more

CURLOPT_FOLLOWLOCATION cannot be activated [duplicate]

Set safe_mode = Off in your php.ini file (it’s usually in /etc/ on the server). If that’s already off, then look around for the open_basedir stuff in the php.ini file, and change it accordingly. Basically, the follow location option has been disabled as a security measure, but PHP’s built-in security features are usually more annoying … Read more

How to display request headers with command line curl

curl’s -v or –verbose option shows the HTTP request headers, among other things. Here is some sample output: $ curl -v * About to connect() to port 80 (#0) * Trying… connected * Connected to ( port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.16.4 (i386-apple-darwin9.0) libcurl/7.16.4 OpenSSL/0.9.7l zlib/1.2.3 > … Read more