php curl抓取网页失败
<?phpheader("content-type:text/html;charset=utf-8");$ch=curl_init();curl_setopt($ch,C...
<?php
header("content-type:text/html;charset=utf-8");
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,'http://210.37.32.7/opac/search?rows=10&hasholding=1&searchWay0=marc&q0=&logical0=AND&q=android&searchWay=title&scWay=dim&searchSource=reader'); //这个网页在浏览器可以直接打开是有效的,也不需要登录认证的
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$data=curl_exec($ch);
//echo(strip_tags(curl_exec($ch)));
curl_close($ch);
echo strip_tags($data);
?>
谁能运行一下看看哪里有问题? 展开
header("content-type:text/html;charset=utf-8");
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,'http://210.37.32.7/opac/search?rows=10&hasholding=1&searchWay0=marc&q0=&logical0=AND&q=android&searchWay=title&scWay=dim&searchSource=reader'); //这个网页在浏览器可以直接打开是有效的,也不需要登录认证的
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$data=curl_exec($ch);
//echo(strip_tags(curl_exec($ch)));
curl_close($ch);
echo strip_tags($data);
?>
谁能运行一下看看哪里有问题? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询