SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with PHP DOMDocument()

    Hello

    I need some help with an issue with DOMDocument().

    I want to gather and parse some XML from other websites. what I come to know is that DOM,s function LOAD() can only read the XML file in the same domain. I want a solution where i can Load() with the help of URL. Something like

    PHP Code:
    $doc = new DOMDocument();
    $doc->load("http://www.server.com/free-feeds/LiveLines.xml"); 
    please help me with this issue.

    Thanks
    Zeeshan

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Try loading the contents from the external file and load that into XMLDocument:
    PHP Code:
    $doc = new DOMDocument();
    $contents file_get_contents('http://www.server.com/free-feeds/LiveLines.xml');
    $doc->loadXML($contents); 
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Congrats to be the member of the month. Really i am inspired by your knowledge and abilities in PHP, THANKS a lot !

    Regards
    Zeeshan


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
  •