PHP + curl, HTTP POST sample code?

前端 未结 11 2388
北荒
北荒 2020-11-21 04:58

Can anyone show me how to do a php curl with an HTTP POST?

I want to send data like this:

username=user1, password=passuser1, gender=1
11条回答
  •  無奈伤痛
    2020-11-21 05:44

     'value1')));
    
    // Receive server response ...
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $server_output = curl_exec($ch);
    
    curl_close ($ch);
    
    // Further processing ...
    if ($server_output == "OK") { ... } else { ... }
    ?>
    

提交回复
热议问题