Имеется код:
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, "http://upload.uploadstation.com/upload/1674884/1/?sessionId=8b4efded-4975-4a2a-ad6c-0b858048fe42&callback=jQuery161026690326338862833_1322892321329&_=1322892321339");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Host: upload.uploadstation.com",
"User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: en-us,en;q=0.5",
"Accept-Encoding: gzip, deflate",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Connection: keep-alive",
"Cache-Control: max-age=0",
));
curl_setopt($ch, CURLOPT_VERBOSE, 1);
echo curl_exec($ch);
curl_close($ch);
Сервер возвращает код 400 Bad Request:
* About to connect() to upload.uploadstation.com port 80 (#0)
* Trying 108.61.5.227... * connected
* Connected to upload.uploadstation.com (108.61.5.227) port 80 (#0)
> GET /upload/1674884/1/?sessionId=8b4efded-4975-4a2a-ad6c-0b858048fe42&callback=jQuery161026690326338862833_1322892321329&_=1322892321339 HTTP/1.1
Host: upload.uploadstation.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Cache-Control: max-age=0
< HTTP/1.1 400 Bad Request
< Server: Apache-Coyote/1.1
< Content-Type: text/html;charset=utf-8
< Content-Length: 971
< Date: Sat, 03 Dec 2011 06:23:24 GMT
< Connection: close
<
* Closing connection #0
<html><head><title>Apache Tomcat/6.0.32 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 400 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The request sent by the client was syntactically incorrect ().</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.32</h3></body></html>
Абсолютно такой же запрос через браузер возвращает правильный результат (LiveHTTP headers):
http://upload.uploadstation.com/upload/1674884/1/?sessionId=8b4efded-4975-4a2a-ad6c-0b858048fe42&callback=jQuery161026690326338862833_1322892321329&_=1322892321339
GET /upload/1674884/1/?sessionId=8b4efded-4975-4a2a-ad6c-0b858048fe42&callback=jQuery161026690326338862833_1322892321329&_=1322892321339 HTTP/1.1
Host: upload.uploadstation.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Cache-Control: max-age=0
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Expires: Mon, 28 Sep 1970 06:00:00 GMT
Cache-Control: private,no-cache,no-store
Pragma: no-cache
Content-Type: text/javascript
Transfer-Encoding: chunked
Date: Sat, 03 Dec 2011 06:16:37 GMT
Найдите отличия.