求教一个PHP采撷代码的写法

WBOY
Release: 2016-06-13 11:59:03
Original
1063 people have browsed it

求教一个PHP采集代码的写法
请问大婶 如果将一个XML完整的采集到PHP
如:
http://www.cailele.com/static/ssc/newlyopenlist.xml
怎么使用PHP怎么采集后并保证采集输出的与XML完全一致

-


------解决方案--------------------

$ch = curl_init();<br /><br />curl_setopt($ch, CURLOPT_URL, "http://www.cailele.com/static/ssc/newlyopenlist.xml");<br /><br />curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); <br />curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />$r = curl_exec($ch);<br />curl_close($ch);<br />header("content-type:text/xml");<br />echo $r;
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!