note 35963 deleted from ref.curl by pollita
| From: | pollita@php.net | Date: | Sun, 21 Sep 2003 02:25:10 +0000 |
| Subject: | note 35963 deleted from ref.curl by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56834@lists.php.net to get a copy of this message | ||
Note Submitter: alwong@12infosys.com
----
The following scripts show how to post form to a web server via https. I modified rodrigo posting
because it did not work for me on IIS5.
<?php
$url = 'https://www.yourserver.com/yourrequest;
$params = "name=your_name&email=youremail@mail.com";
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line makes it work under https
$result=curl_exec ($ch);
curl_close ($ch);
echo("Results: <br>".$result);
?>