Using PHP and Curl, how can I POST to a URL with GET variables?

andy g

New member
Example.
If I need to post fields to a URL I use:
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

If I want to use GET then I omit the:
curl_setopt($ch, CURLOPT_POST, 1);

Effectively switching modes between GET and POST

I would like to POST fields to a URL with GET variables. e.g. POST to example.com/info.php?field=something

Any help would be much appreciated. I'm sure it's a quick on and I'm missing something obvious but I've been scratching my head for a whole beer already.
Thanks
Oh yeah! Thanks Claudio, nice one!
 
Back
Top