HTTP / 1.1 400 BAD REQUEST错误

时间:2015-12-10 12:28:05

标签: php

我的编码就是这个

$number1= $_POST{'username'};
set_time_limit(0);
error_reporting(0);


$post = array(
'phone_number'=>$number1);

$url="https://www.pokketdeal.com/lokiapp/otp"; 

    $headers[]='Content-Type: application/json';
    $headers[]='Content-Length: 31';


 //   $headers[]='X-Mclient: 3';
//  $headers[]='x-wap-profile: http://www.1066.cn/uaprof/prof/Micromax/Micromax_A177.xml';
//  $headers[]='X-Requested-With: com.pokkt.app.pocketmoney';
    $headers[]='Accept-Encoding: gzip,deflate';
    $headers[]='Accept-Language: en-US';
    $headers[]='Accept-Charset: utf-8, utf-16, *;q=0.7';


    $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_USERAGENT, "okhttp/2.3.0" );
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post));
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($ch);
echo $html. "<br>";

提交数据时,我收到服务器响应 HTTP / 1.1 400 BAD REQUEST服务器:nginx / 1.4.6(Ubuntu)日期:星期四,2015年12月10日12:16:40 GMT Content-Type:text / html Transfer-Encoding:chunked Connection:keep-alive X-Frame-选项:SAMEORIGIN 错误请求(400)

我的内容类型是application / json,但响应是text / html。

0 个答案:

没有答案