Link to home
Start Free TrialLog in
Avatar of alpires
alpiresFlag for Brazil

asked on

PHP Headers with cURL

Hi,

How can I get requested headers from the server with cURL ?

I mean, When I posted something with FireFox, my plugin brought me these headers:

POST /central/user/sender_id/do_add.php HTTP/1.1
Host: www.clickatell.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; pt-BR; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pt-br,pt;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: https://www.clickatell.com/central/central/dashboard/senderid_add.php?e_user_no=3744099
Cookie: PHPSESSID=nsfba2f057qs3ro7m6lq1mn8o6
Content-Type: application/x-www-form-urlencoded
Content-Length: 39

senderid=551791245744&e_user_no=3744099



I want to know how do I get it using cURL

ps: its not returntransffer with headers => 1


thanks
ASKER CERTIFIED SOLUTION
Avatar of d4011
d4011
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alpires

ASKER

Hi,

I think CURLINFO_HEADER_OUT is almost what I need.

It outputted all infos I needed EXPECT the post fields/values

any other way ?

tnx
Avatar of alpires

ASKER

With FireFox:

POST /central/user/sender_id/do_add.php HTTP/1.1
Host: www.clickatell.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; pt-BR; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pt-br,pt;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: https://www.clickatell.com/central/central/dashboard/senderid_add.php?e_user_no=3744099
Cookie: PHPSESSID=nsfba2f057qs3ro7m6lq1mn8o6
Content-Type: application/x-www-form-urlencoded
Content-Length: 39

senderid=551791245744&e_user_no=3744099




with CURLINFO_HEADER_OUT:

    [request_header] => POST /central/user/sender_id/do_add.php HTTP/1.1
Cookie: PHPSESSID=cfdc0rk92jkdcato2ai8i0dmj1
Host: www.clickatell.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; pt-BR; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pt-br,pt;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: https://www.clickatell.com/central/central/dashboard/senderid_add.php?e_user_no=3744099
Content-type: application/x-www-form-urlencoded
Content-Length: 39



> It outputted all infos I needed EXPECT the post fields/values
But you defined the post field/values when creating the request.
So you have them already.
Maybe the CURLOPT_VERBOSE option gives you the parameter string.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial