note 35963 added to ref.curl
| From: | alwong at 12infosys dot com | Date: | Sat, 20 Sep 2003 23:34:52 +0000 |
| Subject: | note 35963 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-56827@lists.php.net to get a copy of this message | ||
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);
?>
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35963
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35963&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35963&report=yes