sending an http request with php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jdonnell

    sending an http request with php

    How can I send an http request with php that is similar to the
    following? Notice the raw (unnamed) post data.


    HTTP/1.1 200 OK
    Date: Mon, 12 Aug 2002 01:31:10 GMT
    Status: 200 OK
    Connection: Close
    Content-Length: 510
    Content-Type: text/xml; charset=UTF-8

    <?xml version="1.0"?>
    <myXml>
    .... a bunch of xml here ...
    </myXml>

  • Sjoerd

    #2
    Re: sending an http request with php

    What you specify is a HTTP response. A HTTP request would start with:
    POST /foo.html HTTP/1.1.

    To do such a request, open a socket using fsockopen and fwrite the
    request to it. Alternatively, you may use Curl
    (http://www.php.net/curl) to do a request with specified POST data.

    To make a response such as that you have written, you can just use
    echo() and header() to get what you want.

    Comment

    • jdonnell

      #3
      Re: sending an http request with php

      Thanks, that's what i was looking for.

      p.s. - i copied the wrong http into the message (response instead of a
      request) :(

      Comment

      Working...