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

curl-and-php

Using CURLOPT_RANGE when posting a form.

From: Angelo <gin_at_quicknet.nl>
Date: Thu, 28 Dec 2006 11:10:47 +0100

Hello People,

Usually when you post a form you will be directed to some 'thank you' page.
After curl posted the form, and the 'thank you' page (result page) is over 50kb,
then I only want curl to download the first 50kb of that result page and then stop
and return the data.

I have tried CURLOPT_RANGE to do this, and eventhough it works great
when just 'getting' a page, somehow it won't interrupt the download after 50kb when
posting a form. Anyone any ideas?

I tried the following code:

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'http://www.site.com/post.pl',
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_RANGE, "0-51200");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, 'hi=bye');
        $que = curl_exec($ch);
        curl_close($ch);

Thank you very much!

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-12-28