PHP curl传 json字符串

原文链接: http://www.cnblogs.com/glory-jzx/p/3876747.html
     $ch = curl_init();
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
         curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json; charset=utf-8',
            'Content-Length: '.strlen($data))
     );

服务端获取:

   $GLOBALS['HTTP_RAW_POST_DATA']

转载于:https://www.cnblogs.com/glory-jzx/p/3876747.html

猜你喜欢

转载自blog.csdn.net/weixin_30216687/article/details/94800783