开发者

PHP CURL - scraping xml data that is returned as HTML [duplicate]

开发者 https://www.devze.com 2023-03-14 08:10 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Best XML Parser for PHP
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Best XML Parser for PHP

I am a newbie to PHP and cURL, so please give simple steps! :)

I am trying to scrape data from a website that is returning XML data as HTML.

cURL retrieves the response as '5814 3300' instead of the source

<?xml version="1.0" encoding="iso-8859-1"?><app><info><bookID>58</bookID><firstbook><t>14 </t><status>3</status></firstbook><nextbook><t>30</t><status>0</status></nextbook></info></app>

which I need (so I can do preg_match on the results)

What开发者_StackOverflow社区 can I do to transform the '5814 3300' output into the XML that I need? Thanks!

PLEASE NOTE: This question was asked by me in a confused state. cURL does indeed output the source.


I bet if you looked at the actual source (not what is being rendered on screen) you would see the full XML representation.


Are you outputting that XML to your browser? If you're outputting an HTML content-type, the browser will skip all those unknown tags and simply show their contents. If you view the page source, you'll most likely see the actual XML.

0

精彩评论

暂无评论...
验证码 换一张
取 消