1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

XML file grabbing

Discussion in 'PHP' started by kusadasi-guy, Nov 8, 2004.

  1. #1
    Hi all;

    is there a way to grabbing an xml file from another website? not item by item but all the complete file?
     
    kusadasi-guy, Nov 8, 2004 IP
  2. dejaone

    dejaone Well-Known Member

    Messages:
    992
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    143
    #2
    I believe you can if you know the url of the XML file. Open it in browser and save it.
     
    dejaone, Nov 8, 2004 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    Easiest way:
    $file = file_get_contents('http://forums.digitalpoint.com/external.php');
    PHP:
    With the URL being the URL of the XML file of course.
     
    digitalpoint, Nov 8, 2004 IP
  4. kusadasi-guy

    kusadasi-guy Peon

    Messages:
    83
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <?php  
    $xml = file_get_contents('http://forums.digitalpoint.com/external.php');
    echo ($xml);
     ?>
    PHP:
    Whats wrong with this ? it doesnt work properly :confused:
     
    kusadasi-guy, Nov 8, 2004 IP
  5. THT

    THT Peon

    Messages:
    686
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    shawn, whats get_file_contents like for speed compared to using the curl functions?
     
    THT, Nov 8, 2004 IP
  6. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #6
    They both are pretty instant for me.

    kusadasi - You getting any error?
     
    digitalpoint, Nov 8, 2004 IP
  7. THT

    THT Peon

    Messages:
    686
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ok, ill ivestigate myself
     
    THT, Nov 8, 2004 IP
  8. kusadasi-guy

    kusadasi-guy Peon

    Messages:
    83
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    kusadasi-guy, Nov 8, 2004 IP
  9. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #9
    Looks like XML to me... look at the source.
     
    digitalpoint, Nov 8, 2004 IP
  10. kusadasi-guy

    kusadasi-guy Peon

    Messages:
    83
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Yes, source code is xml but file type is not xml, that why i cant see it as xml. How can i do that file a xml file?

    BUT;

    header('Content-type: application/xml', true);
    PHP:

    i added this but the document is now an XML document.

    Thanks for all your helps ;)
     
    kusadasi-guy, Nov 8, 2004 IP