note 35879 deleted from ref.curl by vincent
| From: | vincent@php.net | Date: | Thu, 18 Sep 2003 17:01:34 +0000 |
| Subject: | note 35879 deleted from ref.curl by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56718@lists.php.net to get a copy of this message | ||
Note Submitter: rodrigo.nakahodo@dhweb.com.br
----
The script shows how to get a simple HTTPS response from SSL server(using CURL session). Enjoy it!
<?php
$defined_vars = get_defined_vars();
$_url = 'https://www.example.com.br';
$_VAR1 = 'nonono';
$_VAR2 = 'nonono';
$_VAR3 = 'nononono';
$post_params = "VAR1=$_VAR1&VAR2=$_VAR2&VAR3=$_VAR3&";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_params);
curl_setopt($ch, CURLOPT_URL,$_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec ($ch);
curl_close ($ch);
echo("Output: ".$result);
?>