首页 > 代码库 > PHP curl传 json字符串

PHP curl传 json字符串

 $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))
     );

PHP curl传 json字符串