Winoa Hairston | 2 May 2006 08:35
Picon
Favicon

Re: post problem

Hi again,
 
 
>From the way it sounds you are trying to show the images and links that you have >obtained from an external site without actually getting the files that they are linking >to.  you will have to add the domain information to the links and such if the domain >that you have acquired is using relative addresses.
 
Yes, I am trying to optain the links and images from an external link and show them on my page. Can anyone help me?
 
Thank you
 


Jon Aston <JonRAston <at> hotmail.com> wrote:
Daniel Stenberg wrote:
On Sat, 29 Apr 2006, Winoa Hairston wrote:
I want to post the result for example from https://foo.com/ and when i am trying to do this the page links
Sorry, but I can't make any sense from your mail or what problem you have. Can you try to show more examples of what you do, what you want to happen and what happens? And feel free to include your current code.
From the way it sounds you are trying to show the images and links that you have obtained from an external site without actually getting the files that they are linking to.  you will have to add the domain information to the links and such if the domain that you have acquired is using relative addresses.

if the link is to bar.jpg you will have to append http://foo.com/ so that you will have the link correct so when the user clicks it will go to http://foo.com/bar.jpg
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
tedd | 2 May 2006 16:19
Favicon
Gravatar

Re: post problem

At 11:35 PM -0700 5/1/06, Winoa Hairston wrote:
>Hi again,
>
>
>  >From the way it sounds you are trying to show the images and links 
>that you have >obtained from an external site without actually 
>getting the files that they are linking >to.  you will have to add 
>the domain information to the links and such if the domain >that you 
>have acquired is using relative addresses.
>
>Yes, I am trying to optain the links and images from an external 
>link and show them on my page. Can anyone help me?
>
>Thank you
>

Winoa:

This sounds more like an html problem than php.

You can show any image on your site by just linking to it. For 
example, if you wanted to pull my logo from my site and place it on 
yours, just add this code to your site:

<img src="http://sperling.com/images/gifs/bird3.gif" alt="">

Is this what you want?

tedd
--

-- 
--------------------------------------------------------------------------------
http://sperling.com
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

lakshmipriya prabhu | 2 May 2006 19:35
Picon
Favicon

File Upload & Post problem - libcurl + PHP

Hi,
 
I am using libcurl + PHP to upload a file and also post some parameters to a website after successful login.
The file to be uploaded and the parameters to be posted is set in an array and the array is posted to the website.
Cookie- handling is also taken care of in the code
libcurl version used : curl 7.15.3 (i586-pc-mingw32msvc) libcurl/7.15.3 OpenSSL/0.9.7c zlib/1.2.2
php version used:php-5.1.2

Problem : Upload & post to the website is not happening and i am getting directed to the error page with trace summary as below
 Expect: 100-continue
 Content-Type: multipart/form-data; boundary=----------------------------0b038ba78c65
 < HTTP/1.1 100 Continue
 < HTTP/1.1 200 OK
 
Could anyone te ll why this problem occurs?
Please find my code and output trace below.
Thanks,
LP
CODE:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?php
 $cookie_file_path = "C:/test/test_cookie.txt"; //  Cookie File path
 $welcomefile ="C:/test/test_welcome.html";  //welcome result
 $resultfile = "C:/test/test_two.html";  //step two result
 $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
 $reffer = "http://pp.qq.rr/";         //referer URL
 $LOGINURL = "https://pp.qq.rr/yy/login.aspx?";  
 $STEPTWOURL="https://pp.qq.rr/zz/upload.aspx?hy=name%20mert&amp;ph=(555)%5666-5619&amp;pe=abc_xyz <at> nnn.com&amp;ft=UUU5&amp;wt=PPFILE";
 
  //-- Before posting parameters to the login page , parsing and getting the viewstate variable
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$LOGINURL);
  curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  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_COOKIEFILE, $cookie_file_path);
  curl_setopt($ ch, CURLOPT_COOKIEJAR, $cookie_file_path);
  $result = curl_exec ($ch);
  preg_match_all("/name=\"__VIEWSTATE\" value=\"(.*?)\"/", $result, $arr_hash_viewstateId);
  $hash_viewstateId = $arr_hash_viewstateId[1][0];
  $hash_viewstateId = urlencode($hash_viewstateId);
  curl_close ($ch);
  $event_target=urlencode('_gt56:loginLink');
  $event_argument=urlencode('"');
  $POSTFIELDS='__EVENTTARGET='.$event_target.'&__EVENTARGUMENT='.$event_argument.'&__VIEWSTATE='.$hash_viewstateId.'&Username=myid&Password=password&Login=In%20In';
   
          echo "\n \n ## POSTFIELDS ON WELCOME : $POSTFIELDS  \n \n";
 
  //--If "System Unavailable" page is result , do nothing 
  if (stristr($result, "System Unavailable"))
  {
   return;
  } //if login fail
  ////////////////////////////////////// LOGIN ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   
  //--Posting parameters to the login page with the viewstate
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$LOGINURL);
  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_COO KIEFILE, $cookie_file_path);
  curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
  
  // output to file
  $fp = fopen ($welcomefile , "w");
  curl_setopt ($ch , CURLOPT_FILE, $fp);
  // execute(form login)
  $result =curl_exec ($ch );
  // close resources
  curl_close ($ch );
  fclose ($fp);
 ////////////////////////////////////// LOGIN /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////// STEP TWO///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 //-- Before posting parameters to the file upload page , parsing and getting the viewstate variable
 
 //replace '&amp' in the URL with '&'
 $STEPTWOURL=str_replace('&amp;','&',$STEPTWOURL);
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL,$STEPTWOURL);
 curl_setopt($ch, CURLOPT_USERAGENT, $agent);
 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_COOKIEFILE, $cookie_file_path);
 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
 $result = curl_exec ($ch);
 
 preg_match_all("/name=\"__VIEWSTATE\" value=\"(.*?)\"/", $result, $arr_hash_viewstateId);
 $hash_viewstateId = $arr_hash_viewstateId[1][0];
 $hash_viewstateId = urlencode($hash_viewstateId);
 
 curl_close ($ch);
 //-- Posting parameters to the file upload page with the viewstate ("multipart/form-data format")
 
 $submitbutton=urlencode('File Submit >>');
 $uploadfile = "sampletest.txt";
 $postData = array();
 $postData[ '__EVENTTARGET' ] = "''";
 $postData[ '__EVENTARGUMENT' ] = "''";
 $postData[ '__VIEWSTATE' ] = $hash_viewstateId;
 $postData[ 'inFile' ] = " <at> sampletest.txt";
 $postData[ 'btnSubmit' ] = $submitbutton;
 
 //$postData = array();
 echo " \n \n :::::::::::::::::::::::    POSTDATA STEP TWO : $postData \n";
 foreach($postData as $key => $value) {
    print "\n $key: $value<br>";
 }
 //--If "System Unavailable" page is result , do nothing 
 if (stristr($result, "System Unavailable"))
 {
  return;
 } //if login fail
   
 //--Posting parameters to the file upload page with the viewstate
 $ch = curl_ini t();
 curl_setopt($ch, CURLOPT_URL, $STEPTWOURL);     
 curl_setopt($ch, CURLOPT_USERAGENT, $agent);
 curl_setopt($ch, CURLOPT_POST, 1 );
  curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_VERBOSE, 1);
 curl_setopt($ch, CURLOPT_HEADER, 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 ($resultfile, "w");
 curl_setopt ($ch , CURLOPT_FILE, $fp);
 // execute(form login)
 $result =curl_exec ($ch );
 // close resources  curl_close ($ch );
 fclose ($fp); 
////////////////////////////////////// STEP TWO ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////// LOGIN ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

OUTPUT TRACE :
==============================================================================================
 ## POSTFIELDS ON WELCOME : __EVENTTARGET=_gt56%3loginLink&__EVENTARGUMENT=%22&__VIEWSTATE=dDwtMjA2MDg5NDYzMzt0PDtsPG
k8MT47aTw0Pjs%2BO2w8dDxwPGw8aW5uZXJodG1sOz47bDxTaWduIEluOz4%2BOzs%2BO3Q8O2w8aTwyPjtpPDY%2BO2k8MTA%2BOz47bDx0PDtsPGk8MT47aT
wzPjs%2BO2w8dDxwPHA8bDxDb21tb24uRGVmYXVsdEhlYWRlci5BZnRlclNpZ25JblJldHVyblRvOz47bDxNaWNoaWdhbi5VbmVtcGxveW1lbnQuV2ViLkIyRy
5Db21tb24uRGVmYXVsdEhlYWRlcitSZXR1cm5Ub1BhZ2UsIE1pY2hpZ2FuLlVuZW1wbG95bWVudC5XZWIuQjJHLCBWZXJzaW9uPTEuMC4yMjAzLjI3MDM5LCBD
dWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGw8Q3VycmVudFJldHVyblVSTD47Pj47PjtsPGk8MT47aTwzPjtpPDU%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PHA8bDxOYXZpZ2F0ZVVybDs%2BO2w8aHR0cDovL3d3dy5taWNoaWdhbi5nb
3Yvc29tLzAsMTYwNyw3LTE5Mi0tLS1BLDAwLmh0bWw7Pj47Pjs7Pjt0PHA8cDxsPE5hdmlnYXRlVXJsOz47bDxodHRwOi8vd3d3Lm1pY2hpZ2FuLmdvdi9zb20
vMCwxNjA3LDctMTkyLTI2OTE0LTIwODgtLSwwMC5odG1sOz4%2BOz47Oz47dDxwPHA8bDxOYXZpZ2F0ZVVybDs%2BO2w8aHR0cDovL3d3dy5taWNoaWdhbi5nb
3Yvc29tLzAsMTYwNyw3LTE5Mi0yNjkxNS0yMDg5LS0sMDAuaHRtbDs%2BPjs%2BOzs%2BO3Q8cDxwPGw8TmF2aWdhdGVVcmw7PjtsPGh0dHA6Ly93d3cubWlja
GlnYW4uZ292L3NvbS8wLDE2MDcsNy0xOTItMjY5MTMtMjA5MC0tLDAwLmh0bWw7Pj47Pjs7Pjt0PHA8cDxsPE5hdmlnYXRlVXJsOz47bDxodHRwOi8vd3d3Lm1
pY2hpZ2FuLmdvdi9zb20vMCwxNjA3LDctMTkyLTI2OTE2LTIzMDEtLSwwMC5odG1sOz4%2BOz47Oz47dDxwPHA8bDxUZXh0Oz47bDxEZXBhcnRtZW50IG9mIExhYm9yICYgRWNvbm9taWMgR3Jvd3RoOz4%2BOz47Oz47Pj47Pj47Pj47Pj47Pth%2F5Bu2oGJ0f4L1cKElMk7t qFDd<br>
 inFile: <at> sampletest.txt<br>
 btnSubmit: File+Submit%3E%3E<br>* About to connect() to pp.qq.rr port 443
*   Trying 136.181.145.40... * connected
* Connected to pp.qq.rr (134.141.143.40) port 443
* SSL connection using RC4-MD5
* Server certificate:
*        subject: /C=US/ST=TTT/L=Lansing/O=YYY/OU=PP.QQ.RR/OU=Terms of use at www.verisig
n.com/rpa (c)00/CN=PP.QQ.RR
*        start date: 2005-10-28 00:00:00 GMT
*        expire date: 2006-10-28 23:59:59 GMT
*        issuer: /C=US/O=RSA Data Security, Inc./OU=Secure Server Certification Authority
* SSL certificate verify result: error number 1 (20), continuing anyway.
> POST zz/upload.aspx?hy=name%20mert&amp;ph=(555)%5666-5619&amp;pe=abc_xyz <at> nnn.com&amp;ft=UUU5&amp;wt=PPFILE HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
Host: PP.QQ.RR
Accept: */*
Referer: http://PP.QQ.RR/
Cookie: .ASPXAUTH=8469F9AC1904321959106FF7C5748E8799667303E205781ED1168E872907D082FB9902DA1FB1EF778CEB5F
42DDA47C22D3CC137A46AEE5AB46D4B4912DAF3746966C3F61BAC4A8B44770857C45BC5134E38EEF9F257561
D3B0C363AA602A22071F053B2FAD896A0651; ASP.NET_SessionId=r3gouertertertgmfe3bc4445
Content-Length: 3843
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------0b038ba78c65
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Date: Tue, 02 May 2006 17:04:36 GMT
< Server: Microsoft-IIS/6.0
< X-Pow ered-By: ASP.NET
< X-AspNet-Version: 1.1.4322
< Cache-Control: no-cache
< Pragma: no-cache
< Expires: -1
< Content-Type: text/html; charset=utf-8
< Content-Length: 9276
* Curl_xxx_rcvs returned -1, block = TRUE
* Curl_xxx_rcvs returned -1, block = TRUE
* Curl_xxx_rcvs returned -1, block = TRUE
* Connection #0 to host PP.QQ.RR left intact
* Closing connection #0
==============================================================================================

New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Daniel Stenberg | 2 May 2006 23:49
Picon
Favicon
Gravatar

Re: File Upload & Post problem - libcurl + PHP

On Tue, 2 May 2006, lakshmipriya prabhu wrote:

> Problem : Upload & post to the website is not happening and i am getting 
> directed to the error page with trace summary as below

> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------0b038ba78c65

Both these are request headers. Are you saying the site returns these?

>  < HTTP/1.1 100 Continue

This is perfectly normal and expected since you sent a Expect: 100-continue.

> < HTTP/1.1 200 OK

And here's an OK response. Now why was this bad again?

--

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

lakshmipriya prabhu | 3 May 2006 00:04
Picon
Favicon

Re: File Upload & Post problem - libcurl + PHP

Hi,
 
The output should show a trace of the file uploaded and the parameters posted.
 
something like below :
 
------------0xKhTmLbOuNdArY
Content-Disposition: form-data; name="name"

my name
------------0xKhTmLbOuNdArY
Content-Disposition: form-data; name="infile"; filename="image.jpg"
Content-Type: image/jpeg
 
after that i should get a  HTTP/1.1 302 confirmation page found and  HTTP/1.1 200 OK.
 
But  i dont get a trace as mentioned above for multipart/form-data upload ,instead i get a  HTTP/1.1 100 and then HTTP/1.1 200  and get redirected to error page.
 
Coul you let me know why this happens?
 
Thanks,
LPDaniel Stenberg <daniel <at> haxx.se> wrote:
On Tue, 2 May 2006, lakshmipriya prabhu wrote:

> Problem : Upload & post to the website is not happening and i am getting
> directed to the error page with trace summary as below

> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------0b038ba78c65

Both these are request headers. Are you saying the site returns these?

> < HTTP/1.1 100 Continue

This is perfectly normal and expected since you sent a Expect: 100-continue.

> < HTTP/1.1 200 OK

And here's an OK response. Now why was this bad again?

--
Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/cur l-and-php

Yahoo! Mail goes everywhere you do. Get it on your phone.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Daniel Stenberg | 3 May 2006 00:11
Picon
Favicon
Gravatar

Re: File Upload & Post problem - libcurl + PHP

On Tue, 2 May 2006, lakshmipriya prabhu wrote:

>  The output should show a trace of the file uploaded and the parameters 
> posted.

Eh, no. If you use the simple CURLOPT_VERBOSE approach it won't.

Which is why I advice you should debug these things using the command line 
client and use the --trace-ascii option.

>  But i dont get a trace as mentioned above for multipart/form-data upload 
> ,instead i get a HTTP/1.1 100 and then HTTP/1.1 200 and get redirected to 
> error page.

The 200 is not a redirect. I take it you meant a HTML redirect...

>  Coul you let me know why this happens?

Yes, the server responds with this when you send the post to it.

And to figure out why the server responds this way, you need to understand 
what it requires and why you don't fulfill that requirement.

LiveHTTPHeaders and --trace-ascii is a super combination to sort that out.

--

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

lakshmipriya prabhu | 3 May 2006 00:24
Picon
Favicon

Re: File Upload & Post problem - libcurl + PHP

Hi ,
 
I am not using the command line client (--trace-ascii option cannot be used) because i need to capture the dynamic "_VIEWSTATE"  variable which needs to be posted to the site which is not possible with the cURL.
 
Even if i disable the CURLOPT_VERBOSE i get the same problem (File not getting uploaded and the parameters not getting posted.)
 
I am using HTTP analyser to track the request/response, cookie etc and emulating it in my code.
 
Could you suggest what is getting missed from my part for the upload and post not happening.
 
Thanks,
Lakshmi
 


Daniel Stenberg <daniel <at> haxx.se> wrote:
On Tue, 2 May 2006, lakshmipriya prabhu wrote:

> The output should show a trace of the file uploaded and the parameters
> posted.

Eh, no. If you use the simple CURLOPT_VERBOSE approach it won't.

Which is why I advice you should debug these things using the command line
client and use the --trace-ascii option.

> But i dont get a trace as mentioned above for multipart/form-data upload
> ,instead i get a HTTP/1.1 100 and then HTTP/1.1 200 and get redirected to
> error page.

The 200 is not a redirect. I take it you meant a HTML redirect...

> Coul you let me know why this happens?

Yes, the server responds with this when you send the post to it.

And to figure out why the server responds this way, you need to understand
what it requires and why you don't fulfill that requirement.

LiveHTTPHeaders and --trace-ascii is a super combination to sort that out.

--
Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Daniel Stenberg | 3 May 2006 00:31
Picon
Favicon
Gravatar

Re: File Upload & Post problem - libcurl + PHP

On Tue, 2 May 2006, lakshmipriya prabhu wrote:

>  I am not using the command line client (--trace-ascii option cannot be 
> used) because i need to capture the dynamic "_VIEWSTATE"  variable which 
> needs to be posted to the site which is not possible with the cURL.

Sure it is, you'd just extract the stuff you need and invoke curl. It is even 
a lot easier if you ask me (but then I don't know much PHP).

>  Even if i disable the CURLOPT_VERBOSE i get the same problem (File not 
> getting uploaded and the parameters not getting posted.)

I certainly didn't mean that CURLOPT_VERBOSE caused your problem. I only 
explained why you didn't see the trace output you missed.

>  I am using HTTP analyser to track the request/response, cookie etc and 
> emulating it in my code.

Then HTTP analyze both a manual operation and then your scripted version and 
compare the requests.

>  Could you suggest what is getting missed from my part for the upload and 
> post not happening.

Sorry, but no. I already guide you to use/debug with libcurl properly and you 
do your programming parts.

--

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

lakshmipriya prabhu | 3 May 2006 00:47
Picon
Favicon

Re: File Upload & Post problem - libcurl + PHP

Hi,
 
Has anyone tried to extract the dynamic '_VIEWSTATE' variable from PHP code and then post parameters including the extracted '_VIEWSTATE' variable and also upload  a file to a site using cURL?.
 
Right now, i am trying to Post parameters including '_VIEWSTATE' variable & Upload file using PHP , libcurl but unable to upload as decribed in my previous messages.
 
If you have posted _VIEWSTATE and uploaded using cURL, please share your ideas or code on the same, would be grateful to you.
 
Thanks,
LP

Daniel Stenberg <daniel <at> haxx.se> wrote:
On Tue, 2 May 2006, lakshmipriya prabhu wrote:

> I am not using the command line client (--trace-ascii option cannot be
> used) because i need to capture the dynamic "_VIEWSTATE" variable which
> needs to be posted to the site which is not possible with the cURL.

Sure it is, you'd just extract the stuff you need and invoke curl. It is even
a lot easier if you ask me (but then I don't know much PHP).

> Even if i disable the CURLOPT_VERBOSE i get the same problem (File not
> getting uploaded and the parameters not getting posted.)

I certainly didn't mean that CURLOPT_VERBOSE caused your problem. I only
explained why you didn't see the trace output you missed.

> I am using HTTP analyser to track the request/response, cookie etc and
> emulating it in my code.

Then HTTP analyze both a manual operation and then your scripted version and
compare the requests.

> Could you suggest what is getting missed from my part for the upload and
> post not happening.

Sorry, but no. I already guide you to use/debug with libcurl properly and you
do your programming parts.

--
Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

Get amazing travel prices for air and hotel in one click on Yahoo! FareChase
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
xinn | 4 May 2006 17:06
Picon

Output controlling/download limit

Hello,

Is this possible to download for example the first 1024 bytes of the
file? With fopen it would look like:

$a = fopen ( 'http://example', 'r' );
print fgets ( $a, 1024 );
fclose ( $a );

How can i do the same using cUrl?

--
L.

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php


Gmane