Other people are already asking how to do this from perl, java, bash, etc., but I need to do it in PHP, and I do not see the question that has already been asked regarding specifically (or with answers to) PHP.
My code is:
$ch = curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch);
This does not work. Destination has print_r($_GET); print_r($_POST); print_r($_GET); print_r($_POST); , so when I look at $result , I should see the fields that are being sent. However, the $ _POST array is empty - I only see get variables. If I delete the query string ?... from $ url, then the POST array will be populated correctly. But now I have no GET parameters. How to do it?
In my particular case, I need to send too much data to match them in the query string, but I cannot send it all as POST, because the site I want to send to selects a handler for the published data based on the variable in the GET string . I can try and change this, but ideally I would like to be able to send and receive and send data in the same request.
source share