Forum Moderators: coopster

Message Too Old, No Replies

Sending POST DATA to a second site

         

moiseszaragoza

9:17 pm on Feb 10, 2010 (gmt 0)

10+ Year Member



RemoteTransaction
I need to send some data to another site using “POST” variables. They are printing info on their page based on the variables that I send over.
Is there a way I can get that information?

Thanks

Sekka

12:22 pm on Feb 11, 2010 (gmt 0)

10+ Year Member



Try the following,

$postData = array(
'var1'=> 'value1',
'var2'=> 'value2',
// etc ...
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_exec($ch);