SitePoint Sponsor

User Tag List

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

    Question URLConnection of PHP

    Does anyone know how to code in PHP to parse html response and also sending a http html request out? just like urlconnection of java. I need to do this using PHP.

    also, I have web url that return xml as response and I also need to send request via xml, anyone has any sample to help in my project ?

    Thanks in advance.

    - trop

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP has build-in stream wrappers. Just open a file handle to the URL and read/write ahead.

    PHP Code:
    // read
    $response file_get_contents("http://www.example.com/foo/bar");

    // write
    $request "qux";
    file_put_contents("http://www.example.com/foo/bar"$request); 


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
  •