Приветствую. Подскажите, как с помощью курл на сервер отправить свои произвольные заголовки ?
COPY /var/www/documents/test/test.pdf HTTP/1.1
Host: localhost.ru
Destination: http://localhost.ru/test.pdf
Overwrite: F
Depth: infinity
Accept: */*
Content-type: application/xml; charset="utf-8"
Делаю все так
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, implode(':', $credentials));
curl_setopt($ch, CURLOPT_URL,"http://localhost.ru");
$request = 'COPY /var/www/documents/test/test.pdf HTTP/1.1
Host: localhost.ru
Destination: http://localhost.ru/test.pdf
Overwrite: F
Depth: infinity
Accept: */*
Content-type: application/xml; charset="utf-8"';
$split = explode("\n",$request);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "COPY");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1 );
curl_setopt ($ch, CURLOPT_HTTPHEADER,$split );
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt ($ch, CURLOPT_HEADER, 1);
$dd = curl_exec($ch);
$info = curl_getinfo($ch);
На выводе своих заголовков я не вижу.
Вот вывод
HTTP/1.1 401 Authorization Required
Date: Thu, 22 May 2014 14:32:13 GMT
Server: Apache/2.2.22 (Debian)
WWW-Authenticate: Digest realm="webdav", nonce="PVee+v35BAA=09cfeb1847eab710c33f3e72be4f7a94d434bd2e", algorithm=MD5, qop="auth"
Vary: Accept-Encoding
Content-Length: 482
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 200 OK
Date: Thu, 22 May 2014 14:32:13 GMT
Server: Apache/2.2.22 (Debian)
Authentication-Info: rspauth="d5010abad112b7ad789498351dfa4146", cnonce="Mjk5OTUz", nc=00000001, qop=auth
Vary: Accept-Encoding
Content-Length: 3068
Content-Type: text/html;charset=UTF-8