cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Problems using cUrl

From: Marco Aurélio de Moraes <moraes_at_catho.com.br>
Date: Tue, 12 Aug 2003 14:00:39 -0300

Hi, everybody

I´m trying to use cUrl to get a web page from a secure server and I can´t do it! I´m using a Linux server, Php 4.2.3, cUrl 7.10.6 and OpenSSL 0.9.7b. When I execute the script, I receive a blank page as a return. Could anyone help me?
That´s the code:

$url = "https://www.server.com/folder/Page.jsp";
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt ($ch, CURLOPT_REFERER, "https://www.myserver.com/folder/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, "var1=value1&var2=value2&var3=value3&var4=value4"); // add POST fields
$result = curl_exec($ch); // run the whole process
curl_close($ch);
echo $result;

Thanks

Marco

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-08-12