First I initialize curl handle:
$ch = curl_init();
Next I set the url and referer headers:
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_REFERER,$referer);
And finally execute statement:
curl_exec($ch);
Now I can use another url without closing and reopening the handle, so:
curl_setopt($ch,CURLOPT_URL,$another_url);
And here headache begins, because I do not know how to disable referer header that would be send do server, of course I've tried to put false
and null
into CURLOPT_REFERER but it causes the referer field to be empty, that is a Referer:
is still send to the server but with no value (is this even correct with http specs?).
Is there any option to remove header altogether without closing and reinstantiating curl handle ?
I'd like to avoid it because curl keeps a connection open for some time, if I would constantly close the handle while downloading from the same host it could take more time.