CURL the headers. I don't understand what's the problem?

Seems blunted... C standard localhost send:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://site.com/some-page");

$aHeaders = array('Host: site.com', 
'Referer: http://site.com/main-page');

curl_setopt($ch, CURLOPT_HTTPHEADER, $aHeaders);

curl_exec($ch);
curl_close($ch);


In other words, I want to say the website site.com I, being on the main page, requesting another page.

But in HttpFox I see this exchange:

(Request-Line) GET /abc/script.php HTTP/1.1
Host localhost
...
...
Referer http://localhost/abc/


ie disguise failed website site.com sees that it is trying to parse from localhost'and. Hence, all resulting redirects, the lack of distribution of information etc. Where blunted?
July 9th 19 at 13:27
1 answer
July 9th 19 at 13:29
Solution
Read the documentation and you will be happy:
curl_setopt($ch, CURLOPT_REFERER, 'http://site.com/main-page');

Find more questions by tags PHPWeb Development