note 35964 deleted from ref.curl by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 19:44:08 +0000 |
| Subject: | note 35964 deleted from ref.curl by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155260@lists.php.net to get a copy of this message | ||
Note Submitter: alwong at 123infosys dot 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);
?>