CURL y https
| From: | Alejandro Tesone | Date: | Sat, 27 Jan 2007 04:00:31 +0000 |
| Subject: | CURL y https | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-60330@lists.php.net to get a copy of this message | ||
Estoy tratando de traer una pagina que esta bajo protocolo https con Curl.
Segun la documentacion y ejemplos deberia funcionar.
Con HTTP funciona con otros sitios, pero con este sitio HTTPS no.
Si alguien tiene idea del porque lo agradecere. Ya llevo dias sin
poder hacerlo funcionar.
Ahi va el codigo:
$url_page = "https://post.craigslist.org/mia/H/apa/none/x"; $user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$cookie_file_path="C:\Documents and Settings\Owner\ApplicationData\Mozilla\Firefox\Profiles\ttcvedub.default\cookies.txt";
$ch = curl_init();curl_setopt ($ch, CURLOPT_URL, $url); $headers = array( "Content-Type: text/html; charset=ISO-8859-1;" ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec ($ch);if ($error = curl_error($ch)) { echo "Error: $error<br />\n"; } return $result; curl_close($ch); Saludos, Alejandro