By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,890 Members | 1,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,890 IT Pros & Developers. It's quick & easy.

PHP HTTPS POST Como hacer un POST https con PHP

P: n/a
http://wedoit4you.com/forums4you/dis...?Msg_pk_id=628

/**
Author: Ing. Angel Leon
Function: postHttps($url,$params)
Given the full URL of the Target and The Params it
will POST the params even
if passing an HTTPS URL.
Returns whatever the URL returns.
*/
function postHttps($url,$params) {
$ch = curl_init ($url);

curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec ($ch);
curl_close ($ch);

return $result;
} //end postHttps

//Sample of usage.
//Suppose you want to submit credit card information and your merchant
account
//loggin and password, but you dont want ur login and password to be
on the
//HTML form as hidden fields... you need a script that posts all
//this information directly to the ending cgi/dll/script through
HTTPS...

$url='https://creditcard.net/transact.dll';
$params='cc=33442342323&cc_exp_date=0304&amount=15 0&merchant_login=our_login&merchant_password=our_p assword';

postHttps($url,$params); //LISTO!!!

By Angel Leon
Jul 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.