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

curl-and-php

Re: RE : Curl-and-php digest, Vol 1 #428 - 3 msgs

From: Laurie Barker <laurie_at_oneuponedown.com>
Date: Wed, 19 Nov 2003 10:43:30 +0000

Hello

Just to add my two penceŠ

We found when we tested the speed between the native PHP implementation of
Curl that it was notable slower than using the command line version via exec
in PHP - exec even returns the curl error code simplifying debug.

We all love PHP but you should also take into account the overhead involved
and if PHP has been complied with all the bells and whistles this simply
increases the hit. Run a version of PHP on your development box with
everything you can stuff in and then only build in the elements required on
your live box.

On 19/11/03 08:07 you wrote:

> 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/
>

--
OneUpOneDown Creative Solutions Ltd
--
Laurie Barker
--
T: +44 (0)20 8527 4440
--
F: +44 (0)20 8527 4527
--
E: laurie-barker_at_oneuponedown.co.uk
--
W: http://www.oneuponedown.co.uk
--
-------------------------------------------------------
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