SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can PHP send an XML document to an address then read response?

    Hi all,

    I have a webform which posts XML data to an address, which then returns an XML document.

    Code:
    <form method="post" action="http://www.someurl.com">
      <textarea name="data"></textarea>
      <input type="submit">
    </form>
    Inside the textarea would be raw XML text that the user would type in.


    What I would like to know is can PHP submit (POST) the data to "someurl.com" and then read the XML response.

    Failing this, is there an alternative way to send the data and read the response?

    Many thanks,
    Laurence.

  2. #2
    SitePoint Evangelist chiphunt1's Avatar
    Join Date
    Oct 2003
    Location
    louisville, ky
    Posts
    436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How is the XML response sent back? As POST data?
    Calm down -- it's only ones and zeroes

  3. #3
    SitePoint Guru OfficeOfTheLaw's Avatar
    Join Date
    Apr 2004
    Location
    Quincy
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, there are several methods to do it... you could use curl to send the xml and get the response back, and if you are using soap or xml-rpc you can avoid reinventing the wheel by using either the PEAR classes for xml-rpc and soap, nusoap, or php5's built in SOAP and XML-RPC handlers.

    James Carr, Software Engineer


    assertEquals(newXPJob, you.ask(officeOfTheLaw));


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •