国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

http-client post有問(wèn)題,請(qǐng)教各位是怎么回事?

veinliu

如題:直接用網(wǎng)上找到PHP代碼測(cè)試,接口返回結(jié)果正常,但用http-client post 之后對(duì)方?jīng)]有得到數(shù)據(jù);
我要post 的數(shù)據(jù)為:

{"way_code":"001","position":"1","RfidNo":"1000000002"}
function send_post($url, $post_data) {

    //$postdata =  http_build_query($post_data);

    $options = array(

        'http' => array(

            'method' => 'POST',

            'header' => 'Content-type:application/x-www-form-urlencoded',

            'content' => '{"way_code":"001","position":"1","RfidNo":"1000000002"}',

            'timeout' => 15 * 60 // 超時(shí)時(shí)間(單位:s)

        )

    );

    $context = stream_context_create($options);

    $result = file_get_contents($url, false, $context);

    echo $result;

    return $result;

}
send_post('http://192.168.11.129:2121', $post_data);

這樣返回的結(jié)果正常。

 $post = '{"way_code":"001","position":"1","RfidNo":"1000000002"}';
           // var_dump($post);
            $http = new Workerman\Http\Client();
            $http->post('http://172.50.10.2:7090/facematch/v1/request', $post, function($response){
           // $http->post('http://192.168.11.129:2121',  $post, function($response){
             //   var_dump($response->getStatusCode());
               // var_dump($response->getBody());
                echo $response->getBody();
                return $response->getBody();
            }, function($exception){
                echo $exception;
            });
            這樣POST,從返回的結(jié)果看對(duì)方接口好像什么數(shù)據(jù)都沒(méi)收到。
            都post到自己的測(cè)試接口,http://192.168.11.129:2121
            var_dump $_POST
            結(jié)果是一樣的
            array(1) {
  ["{"way_code":"001","position":"1","RfidNo":"1000000002"}"]=>
  string(0) ""
}

就是沒(méi)想明白哪里不對(duì)了。

2862 1 0
1個(gè)回答

walkor 打賞

v0.1.2 已經(jīng)修復(fù)

  • veinliu 2019-12-08

    我怎么升級(jí)到v0,1,2

  • veinliu 2019-12-08

    您這個(gè)響應(yīng)速度也太快了點(diǎn)!就是能不能給我點(diǎn)積分,我沒(méi)積分不能發(fā)貼和回貼了。

年代過(guò)于久遠(yuǎn),無(wú)法發(fā)表回答
??