PHP cURL GET request and request's body

前端 未结 5 1279
礼貌的吻别
礼貌的吻别 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条回答
  •  萌比男神i
    2020-12-05 00:34

       "2"];
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL,'https://example.com/student_list.php');
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
      $response = curl_exec($ch);
      $result = json_decode($response);
      curl_close($ch); // Close the connection
      $new=   $result->status;
      if( $new =="1")
      {
        echo "";
      }
      else 
      {
        echo "";
      }
    
      ?>
    

提交回复
热议问题