當我在CURL
在PHP中。與適當的標題和字段,但它會給我錯誤錯誤400錯誤的請求。爲什麼會出現這個錯誤?錯誤400錯誤的請求,當我使用PHP CURL
HTTP/1.0 400 Bad request Cache-Control: no-cache Connection: close Content-Type: text/html
400 Bad request
Your browser sent an invalid request. 1
頭請求
$header[] = "Accept:application/json, text/javascript, */*; q=0.01";
$header[]="Accept-Encoding:gzip, deflate";
$header[] = "Cache-Control:max-age=0";
$header[]= "Accept-Language:en-US,en;q=0.5";
$header[] = "Content-Length:37";
$header[]="Content-Type:application/x-www-form-urlencoded; charset=UTF-8";
$header[]="Cookie:__qca=P0-116849880-1387336057175; __utma=140029553.335591273.1387336057.1389609300.1389617402.102; __utmz=140029553.1389617402.102.89.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); _ga=GA1.2.335591273.1387336057; sgt=id=3380ce36-a139-4845-bd20-5bb3fd4174ec; usr=t=qrthm51g2UyV&s=QtuIYj84zEOR";
$header[]="X-Requested-With:XMLHttpRequest";
捲曲代碼
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_HEADER, $header);
curl_setopt($ch, CURLOPT_POST, $fields);
curl_setopt($ch, CURLOPT_, $value);
$response=curl_exec($ch);
curl_close($ch);
如果您想進一步的數據,請發表評論我會詳細說明。
請顯示請求標題。 – DanFromGermany
你能告訴我們實際的代碼嗎? – Kita
檢查https。 – Imat