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

curl-and-php

Re: String length limitation with curl.

From: Manish Katiyar <mkatiyar_at_gmail.com>
Date: Thu, 16 Apr 2009 09:27:31 +0530

On Thu, Apr 16, 2009 at 7:53 AM, Manish Katiyar <mkatiyar_at_gmail.com> wrote:
> Hi ,
>
> Is there any limitation about how long a string can be while sending
> data from curl. I have below code. It works when the file is small but
> not when the file size is large. Or does it matter how many nodes are
> there in xml file, because when i delete some nodes it works.

Here are some more details :-

For the failed case I get this

Array
(
    [url] => http://localhost/auto/processxml.php
    [http_code] => 417
    [header_size] => 135
    [request_size] => 161
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.03249
    [namelookup_time] => 0.03221
    [connect_time] => 0.032315
    [pretransfer_time] => 0.032324
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 0
    [upload_content_length] => 1085
    [starttransfer_time] => 0.032456
    [redirect_time] => 0
)

cURL error number:0

While for the passed case I get this :-

Array
(
    [url] => http://localhost/auto/processxml.php
    [content_type] => text/html
    [http_code] => 200
    [header_size] => 170
    [request_size] => 1032
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.301085
    [namelookup_time] => 0.034482
    [connect_time] => 0.034649
    [pretransfer_time] => 0.03466
    [size_upload] => 0
    [size_download] => 609
    [speed_download] => 2022
    [speed_upload] => 0
    [download_content_length] => 0
    [upload_content_length] => 0
    [starttransfer_time] => 0.301003
    [redirect_time] => 0
)

Thanks -
Manish
>
> /home/mkatiyar> cat postxml.php
> <?php
> function postData($postFileds,$url){
>                $ch = curl_init();
>                curl_setopt($ch, CURLOPT_URL, $url);
>                curl_setopt($ch, CURLOPT_POST      ,1);
>                curl_setopt($ch, CURLOPT_POSTFIELDS    ,$postFileds);
>                curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1);
>                curl_setopt($ch, CURLOPT_HEADER      ,0);
>                curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);
>                $data = curl_exec($ch);
>                curl_close($ch);
>                return $data;
>        }
>
> $xmlData = file_get_contents("report.xml");
> $postFileds = 'data='. urlencode($xmlData);
>
> $result=postData($postFileds,"http://localhost/auto/processxml.php");
> echo $result;
> ?>
>
>
> /home/mkatiyar> wc report.xml
>  23  25 714 report.xml         <====== doesn't work for this size.
> /home/mkatiyar/gold> wc abusereport.xml
>  19  21 589 report.xml         <==== Works for this size.
>
>
> --
> Thanks -
> Manish
>

-- 
Thanks -
Manish
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-04-16