Go to Google Groups Home    Amee Developer
Re: [amee-developer] PHP HTTP Request

Thade O'Connor <thade.ocon...@gmail.com>

Hi J.J.

I tried that request, and got the same result as you.  This one works:

POST /auth HTTP/1.0
Accept: application/xml
Host: stage.co2.dgen.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 35

username=********&password=********

the only difference is that the Host header is stage.co2.dgen.net rather
than http://stage.co2.dgen.net.

Regards,

Thade

2009/3/13 jj <jjshea...@gmail.com>

> I'm developing a website project using PHP, and the http request code
> I have for getting authorization from the AMEE database is:

> $header = POST /auth HTTP/1.0\nAccept: application/xml\nHost:
> http://stage.co2.dgen.net\nContent-Type: application/x-www-form-
> urlencoded\nContent-Length: 36\n\nusername=/**username**/&password=/
> **password**/;
> $s = socket_create(AF_INET, SOCK_STREAM, 0);
> $z = socket_connect($s, "193.34.29.200", $port);
> socket_write($s, $header, strlen($header));

> I got this code from the php with sockets example in the developers
> area of the AMEE website.

> This code is creating the connection between my website and the AMEE
> website, but the http request above is causing a 400 bad request
> error.

> How do I change this code to get the authorisation token from the AMEE
> website?

> Thanks,
> J.J.