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

curl-and-php

Re: Downloading a file instead of the web page

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 26 Mar 2002 16:55:10 +0100 (MET)

On Tue, 26 Mar 2002, Peter Bowyer wrote:

> >When I try that form manually, I get a "application/text" thing back. You
> >should get that too when you post with curl.
>
> Can't see it anywhere in the curl verbose output - should I be able to?

If you do a post the way the browser does, should should, yes. If the browser
gets it, so should curl.

> >I don't know if this is relevant or not here, but line separators should be
> >done with CRLF in posts.
>
> Have changed that but no difference :-) Does curl encode them or do I have
> to? My browser was sending %0D%0A instead of \r\n so I need to now which
> to send myself.

Right, curl won't encode them. You need to do that yourself.

> They do. with curl on the verbose setting it shows these headers:
> * Connected to php-accelerator.co.uk (212.67.208.211)
> > POST /activate.php HTTP/1.1
> User-Agent: phpa key bot by Peter
> Host: www.php-accelerator.co.uk
> Pragma: no-cache
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> Content-Length: 365
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=curlR23kNCTQJOv8FaLoBmnU9yDA5+f

*beeep*

This is a multipart formpost, you don't want to do that. The form you want to
fill in is a normal post.

[snip]

> Notice the different Content-type line? According to the PHP manual the
> second Content-type (the one sent from my browser) is the one which curl
> should be sending. Is this correct? It's the only difference I can see
> which could be causing the problem.

Correct, the broswer sends a normal post which you should do too.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-03-26