Hi
Is it possible to send a POST request by setting the POST request in page headers. If so let me know where do I put POST in the headers.
Thanks
[Solved]POST REQUEST using php headers
Moderator: General Moderators
[Solved]POST REQUEST using php headers
Last edited by dude81 on Mon Feb 26, 2007 10:08 pm, edited 1 time in total.
Let's take a look at the request my browser send for retrieving this page. It opens a socket to the server and send the following "text"
A equvivalent post request isGET /posting.php?mode=reply&t=64216&sid=[...] HTTP/1.1
Host: forums.devnetwork.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.8,de-de;q=0.5,de;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
Cookie: [...]
What are you trying to achieve?POST /posting.php HTTP/1.1
Host: forums.devnetwork.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.8,de-de;q=0.5,de;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
Cookie: [...]
Content-Length: 28
mode=reply&t=64216&sid=[...]
You cannot use header() for that. header() is used to set a response-header not to initiate a request.
Take a look at http://de2.php.net/soap and/or http://sourceforge.net/projects/nusoap/
Take a look at http://de2.php.net/soap and/or http://sourceforge.net/projects/nusoap/
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Not sure if you've got your answer, but I recently had to send POST data as well. Do a Google search for something along the lines of "PHP send POST data". There are a few examples out there that use fsockopen() & related functions.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
I really thank you for the solution. I'm using SOAP in full swing now and I've gone too far in it. I don't like to go back now again on fsockopen as I've crossed my deadline too.pickle
Not sure if you've got your answer, but I recently had to send POST data as well
My Service provider initially gave me the document for POST and GET and as well as soap. That means I can use any of the method. SOAP is what is preferable by them.volka
? please Explain