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

curl-and-php

curl error : 52 - help

From: lakshmipriya prabhu <prabhu_priya_at_yahoo.com>
Date: Mon, 2 Oct 2006 10:43:24 -0700 (PDT)

 
  Hi,
   
  Please provide any help on below problem.
   
  Problem :
-----------
   
  Please find attached the log trace for the steps through "Browser" and same through "PHP+libcurl" scripts and also the "libcurl script" for this.
  Below error occurs during the php-libcurl scripts execution.I am able to login to the website perform all following actions ("GET"/"POST")until the below step where i get this error.
  
Details of the Error:
======================
 
cURL error number :52
cURL error:error Empty reply from server* Closing connection #0 { which means, "Nothing was returned from the server "}
  As seen in the attached trace :-
 
1) The Request is same as Browser Request
2) There is a correct redirection by server to “GET” "https://abc.def.ghi/ABC/Upload.asp?pqr=2"
 
But instead of “Getting https://abc.def.ghi/ABC/Upload.asp?pqr=2%94 there is error as mentioned above
  a)Is it because web browsers always work slower than the curl?
b)Is it that test.php takes longer time to run and the curl process returns before it finishes?
  If so, how can we delay the curl execution-time?
c)Is it a problem at server - end? unfortunately, i donot have access to the server logs.
  
Please provide any help / suggestion if someone had this problem.
  Thanks in advance,
LP
 
Here's the 'Script' :
--------------------
  
echo " ENTER #######";
  
 //POSTING to https://abc.def.ghi/ABC/Upload.asp?pqr=1
 $URL = "https://abc.def.ghi/ABC/Upload.asp?pqr=1";
 $reffer ="https://abc.def.ghi/ABC/Upload.asp?frompage=fromaspnet.asp";
 $POSTFIELDS="txtLines=0&optType=1&Delimiter=%2C&txtDelimiter=&Qualifier=%22&txtQualifier=&cmdSubmit.x=54&cmdSubmit.y=20";
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_SSLVERSION,2);
 curl_setopt($ch, CURLOPT_URL,$URL);
 curl_setopt($ch, CURLOPT_VERBOSE, 1);
 curl_setopt($ch, CURLOPT_USERAGENT, $agent);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 curl_setopt($ch, CURLOPT_REFERER, $reffer);
 curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
 
   
 //output to file
 $fp = fopen ($file, "w");
 curl_setopt ($ch , CURLOPT_FILE, $fp);
  
 //execute
 $result =curl_exec ($ch );
   // print errors
 print_r(curl_getinfo($ch));
 echo "\n\ncURL error number:" .curl_errno($ch);
 echo "\n\ncURL error:" . curl_error($ch);
   //close resources
 curl_close ($ch );
        fclose ($fp);
  echo "EXIT #######";
  Here's the 'Trace' :
--------------------
  
========== BROWSER TRACE ===========================
  POST /ABC/Upload.asp?pqr=1 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*
Referer: https://abc.def.ghi/ABC/Upload.asp?frompage=fromaspnet.asp
Accept-Language: en-us
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Host: abc.def.ghi
Content-Length: 124
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: ASP.NET_SessionId=oqsrg0fzyi04l255yludwi55; ASPSESSIONIDQQQBBDAQ=FJMFABKCPBLBDKEJDOACACMC
  txtLines=0&optType=1&Delimiter=%2C&txtDelimiter=&Qualifier=%22&txtQualifier=&cmdSubmit.x=54&cmdSubmit.y=20
  HTTP/1.1 302 Object moved
Connection: close
Date: Fri, 29 Sep 2006 22:36:04 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Location: Upload.asp?pqr=2
Content-Length: 144
Content-Type: text/html
Cache-control: private
  <head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found here.</body>
  ========== BROWSER TRACE ==========================
##############################################################################################
   
  ********** LIBCURL(SCRIPTS) TRACE **************************************
 ENTER STEP #######*
About to connect() to abc.def.ghi port 443
* Trying 167.196.94.203... * connected
* Connected to abc.def.ghi (aaa.bbb.cc.ddd) port 443
* SSL connection using DES-CBC3-MD5
> POST /ABC/Upload.asp?pqr=1 HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1
.4322)
Host: abc.def.ghi
Accept: */*
Referer: https://abc.def.ghi/ABC/Upload.asp?frompage=fromaspnet.asp
Cookie: ASPSESSIONIDQQQBBDAQ=KJMFABKCLGPICEBANFDBLFCH; ASP.NET_SessionId=isliqa4
5maky2hejbpr1tw55
Content-Length: 124
Content-Type: application/x-www-form-urlencoded
  txtLines=0&optType=1&Delimiter=%2C&txtDelimiter=&Qualifier=%22&txtQualifier=&cmdSubmit.x=54&cmdSubmit.y=20< HTTP/1.1 302 Object moved
< Connection: close
< Date: Sat, 30 Sep 2006 00:04:18 GMT
< Server: Microsoft-IIS/6.0
< X-Powered-By: ASP.NET
< Location: Upload.asp?pqr=2
< Content-Length: 144
< Content-Type: text/html
< Cache-control: private
* Closing connection #0
* Issue another request to this URL: 'https://abc.def.ghi/ABC/Upload.asp?pqr=2'
* Disables POST, goes with GET
* About to connect() to abc.def.ghi port 443
* Trying aaa.bbb.cc.ddd... * connected
* Connected to abc.def.ghi (aaa.bbb.cc.ddd) port 443
* SSL re-using session ID
* SSL connection using DES-CBC3-MD5
> GET /ABC/Upload.asp?pqr=2 HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1
.4322)
Host: abc.def.ghi
Accept: */*
Referer: https://abc.def.ghi/ABC/Upload.asp?frompage=fromaspnet.asp
Cookie: ASPSESSIONIDQQQBBDAQ=KJMFABKCLGPICEBANFDBLFCH; ASP.NET_SessionId=isliqa4
5maky2hejbpr1tw55
  * Empty reply from server
* Connection #0 to host abc.def.ghi left intact
Array
(
    [url] => https://abc.def.ghi/ABC/Upload.asp?pqr=2
    [content_type] => text/html
    [http_code] => 302
    [header_size] => 240
    [request_size] => 905
    [filetime] => -1
    [ssl_verify_result] => 20
    [redirect_count] => 1
    [total_time] => 1.422
    [namelookup_time] => 0
    [connect_time] => 0.094
    [pretransfer_time] => 0.281
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => 144
    [upload_content_length] => 0
    [starttransfer_time] => 0.5
    [redirect_time] => 0.922
)
  
cURL error number:52
  cURL error:Empty reply from server* Closing connection #0
  EXIT STEP #######
  ********** LIBCURL TRACE **************************************
  
 

 __________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

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