PHP cURL custom headers

123 picture 123 · Nov 14, 2011 · Viewed 595.6k times · Source

I'm wondering if/how you can add custom headers to a cURL HTTP request in PHP. I'm trying to emulate how iTunes grabs artwork and it uses these non-standard headers:

X-Apple-Tz: 0
X-Apple-Store-Front: 143444,12

How could I add these headers to a request?

Answer

Brad picture Brad · Nov 14, 2011
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'X-Apple-Tz: 0',
    'X-Apple-Store-Front: 143444,12'
));

http://www.php.net/manual/en/function.curl-setopt.php