note 98164 added to function.curl-setopt
| From: | shailesh4all at gmail dot com | Date: | Sat, 29 May 2010 10:42:46 +0000 |
| Subject: | note 98164 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169710@lists.php.net to get a copy of this message | ||
Hi,
Anyone who is interested in submitting their information by post to HTTPS site (e.g. payment
gateway) where https page needs basic authentication before submitting the information. below code
will be helpful.
$submit_url = "https://sitename/process.php";
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($curl, CURLOPT_USERPWD, "username:password");
curl_setopt($curl, CURLOPT_SSLVERSION,3);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT
5.0)");
curl_setopt($curl, CURLOPT_URL, $submit_url);
$data = split("text/html", curl_exec($curl) );
$temp = split("\r\n", $data[1]) ;
$result = unserialize( $temp[2] ) ;
print_r($result);
curl_close($curl);
----
Server IP: 69.147.83.197
Probable Submitter: 131.170.90.3
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/98164
Del: integrated -- https://master.php.net/note/delete/98164/integrated
Del: useless -- https://master.php.net/note/delete/98164/useless
Del: bad code -- https://master.php.net/note/delete/98164/bad+code
Del: spam -- https://master.php.net/note/delete/98164/spam
Del: non-english -- https://master.php.net/note/delete/98164/non-english
Del: in docs -- https://master.php.net/note/delete/98164/in+docs
Del: other reasons-- https://master.php.net/note/delete/98164
Reject -- https://master.php.net/note/reject/98164
Search -- https://master.php.net/manage/user-notes.php