curl-and-php
RE : Curl-and-php digest, Vol 1 #428 - 3 msgs
Date: Wed, 19 Nov 2003 09:07:42 +0100
Thanks Daniel Stenberg for your response.
I just add
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
in my code and then it works fine
However my code is very slow (versus a simple IE browser emulate with
visual basic (SIC!)).
My code takes 30 seconds to be done (versus 10 seconds with IE).
Is there something to do to speed up navigation under libcurl? I really
want to stop using MS tools!
THE CODE
========
<?php
set_time_limit(0);
$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
$ref = "http://www.mcm.net/membres/login.php";
$ch = curl_init("");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "-");
curl_setopt($ch, CURLOPT_URL,"http://www.mcm.net/membres/login.php");
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"user%5Blogin%5D=testacc&user%5Bpassword%5D=testacc
&action=valider&value.x=18&value.y=7");
ob_start(); // prevent any output
curl_exec ($ch); // execute the curl command
ob_end_clean(); // stop preventing output
curl_close ($ch);
echo $ch;
flush();
?>
Another question
=================
Sometimes in forms there are hidden fields which contains session data
or other datas depending on the connection, I would like to know if
someone as a ready function to extract hidden fields to populate a
correct postdata string...
Wilfrid
PS : I create a test account on www.mcm.net (testacc / testacc)
--__--__--
Message: 3
Date: Tue, 18 Nov 2003 10:22:48 +0100 (CET)
From: Daniel Stenberg <daniel-curl_at_haxx.se>
To: curl and php list <curl-and-php_at_lists.sourceforge.net>
Subject: Re: Problem posting
Reply-To: curl-and-php_at_lists.sourceforge.net
On Tue, 18 Nov 2003 contact_at_lespagesjeux.com wrote:
> I very new to LibCurl and would like to post data other a French
website to
> connect and get periodically data information on it. Before sending
this
> email to the group I try this code on my local network and it was
pretty
> good but other the web nothing works!
Well, your curl functions look fine. It really isn't easy for anyone to
understand what "nothing works" mean in this case and what you want us
to help
you with. We don't have any login to that site.
What does the site respond? What did you expect it to respond that it
doesn't?
Should you follow locations?
-- Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/ [[ Do not post private mails to this email address. They won't reach me. ]] --__--__-- ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/Received on 2003-11-19