时间:2021-07-01 10:21:17 帮助过:18人阅读
//$html 就是获取的页面 html$s = simplexml_load_string($html);foreach($s->ul[0] as $li){ echo $li->h6[0].' - '.$li->p[0].'
';}/*PC Game Servers - Updated: 9:51 PM CST May, 15 Playstation 3 - Updated: 9:51 PM CST May, 15 XBOX 360 - Updated: 9:51 PM CST May, 15 XBOX One - Updated: 9:51 PM CST May, 15 Playstation 4 - Updated: 9:51 PM CST May, 15 */
//$html 就是获取的页面 html$s = simplexml_load_string($html);foreach($s->ul[0] as $li){ echo $li->h6[0].' - '.$li->p[0].'
';}/*PC Game Servers - Updated: 9:51 PM CST May, 15 Playstation 3 - Updated: 9:51 PM CST May, 15 XBOX 360 - Updated: 9:51 PM CST May, 15 XBOX One - Updated: 9:51 PM CST May, 15 Playstation 4 - Updated: 9:51 PM CST May, 15 */
//$html 就是获取的页面 html$s = simplexml_load_string($html);foreach($s->ul[0] as $li){ echo $li->h6[0].' - '.$li->p[0].'
';}/*PC Game Servers - Updated: 9:51 PM CST May, 15 Playstation 3 - Updated: 9:51 PM CST May, 15 XBOX 360 - Updated: 9:51 PM CST May, 15 XBOX One - Updated: 9:51 PM CST May, 15 Playstation 4 - Updated: 9:51 PM CST May, 15 */
网站做了限制,你要打开这个网页查看它的cookie,并复制出来放在 $strCookie 中,我的cookie串就是下面 $strCookie的内容,改成你的就可以了
$strCookie = 'oauth_redirect=/en/server-status/fifa-2016/; PHPSESSID=nuqjjqj9aagnc8j2mglf82dj45; AWSELB=A32F41DF08C4BE7B7084C2525E0A6EA0DB38F970292F10DAB9FBCCA7735A84837B2C3A00FA5C83230EF9357A7A9E719B7CF0224072C74548F89DB34FEF6BDDBD0F640DAA52E77AC24ADCBD1AEEB365AA2D9CA5CA37';$url = 'http://help.ea.com/en/server-status/fifa-2016/';$html = mcurl($url,$strCookie); //紧接上面的代码//$s = simplexml_load_string($html);.....function mcurl($url,$strCookie) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_COOKIE, $strCookie); $data = curl_exec($ch); curl_close($ch); return $data;}