使用curl和https网址的400个错误请求

I'm using curl (through symfony's plugin sfWebBrowser along with sfCurlAdapter), and I'm trying to do a very simple POST request on an https url.

Doing this with a normal browser gives 200 OK, whereas curl gets a "400 Bad Request" error.

I used the verbose option on curl, and here is what I got :

* About to connect() to preprod-ppps.paybox.com port 443 (#0)
*   Trying 195.101.99.73...   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* connected
* Connected to preprod-ppps.paybox.com (195.101.99.73) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*        subject: C=FR; postalCode=78280; ST=Yvelines; L=GUYANCOURT; street=11A rue Jacques Cartier; O=PAYBOX SERVICES; OU=0002 431408608; OU=X509 Omnidomaine TBS; CN=*.paybox.com
*        start date: 2009-08-17 00:00:00 GMT
*        expire date: 2011-10-03 23:59:59 GMT
*        subjectAltName: preprod-ppps.paybox.com matched
*        issuer: C=GB; ST=Greater Manchester; L=Salford; O=Comodo CA Limited; CN=AAA Certificate Services
*        SSL certificate verify ok.
> POST /PPPS.php HTTP/1.1
Host: preprod-ppps.paybox.com
Accept: */*
Accept-Encoding: gzip,deflate

< HTTP/1.1 400 Bad Request
< Date: Wed, 06 Apr 2011 11:56:35 GMT
< Server: HttpServer
< Content-Length: 226
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
< 
100   226  100   226    0     0    793      0 --:--:-- --:--:-- --:--:--  1013* Closing connection #0

I also tried setting every header I could see with firebug, so that the request is the same in both cases, without success. What went wrong?

It seems like you have no post-data with your request. You probably have not set up your curl transfer properly.

You should have at least a Content-Length header with your POST.

Maybe they block curl as they think it is a bot trying to attack their system. They will be able to detect the user agent from the headers you send with your request.