PHP cURL GET request and request's body

前端 未结 5 1289
礼貌的吻别
礼貌的吻别 2020-12-05 00:23

i\'m trying using cURL for a GET request like this:

function connect($id_user){
    $ch = curl_init();
    $headers = array(
    \'Accept: application/json\'         


        
5条回答
  •  生来不讨喜
    2020-12-05 00:48

    you have done it the correct way using

    curl_setopt($ch, CURLOPT_POSTFIELDS,$body);
    

    but i notice your missing

    curl_setopt($ch, CURLOPT_POST,1);
    

提交回复
热议问题