请问一个简单的PHP知识,这里的代码哪里出错了啊?采集不到了? 400 报错
<?php header('Content-Type:text/html; charset=utf-8'); if(date('Y-m-d H:i:s')>='2016-09-21 21:17:00') { echo "授权到期,如需续费,联系QQ:1615833313";exit; } else { echo "正常"; } require ("curl_http.php"); function trimall($str){ $qian=array("-"," "," ","\t","\n","\r");$hou=array("","","","","",""); return str_replace($qian,$hou,$str); } $curl = &new Curl_HTTP_Client(); $html_data = $curl->fetch_url("http://www.1395p.com/shishicai/"); $html_data=trimall($html_data); $mode="#<trclass='even'><td><pclass="p">(.?)</p><pclass="t">(.?)</p></td><tdclass="nums"><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.*?)</span></td>#";preg_match_all($mode,$html_data,$arr);$html_data1=$arr[0][0]; preg_match_all($mode,$html_data1,$arr1); echo "号码是:".$hm1=$arr1[3][0];echo $hm2=$arr1[4][0]; echo $hm3=$arr1[5][0]; echo $hm4=$arr1[6][0]; echo $hm5=$arr1[7][0]; $num1=$hm1; $num2=$hm2; $num3=$hm3; $num4=$hm4; $num5=$hm5; echo "期号是:".$arr1[1][0]; $qishu=$arr[1][0]; $time=date('Y-m-d')." ".$arr1[2][0]; echo "取出开奖时间:".$time; echo "如不对,请修改数据库"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
首先 进不到if里面去 第二 php页面写html代码需要echo 第三 html代码需要用单引号或者双引号引起来
######
<?php header('Content-Type:text/html; charset=utf-8'); if (date('Y-m-d H:i:s') >= '2016-09-21 21:17:00') { echo "授权到期,如需续费,联系QQ:1615833313"; exit; } else { echo "正常"; } //require ("curl_http.php");
function trimall($str) { $qian = array("-", " ", " ", "\t", "\n", "\r"); $hou = array("", "", "", "", "", ""); return str_replace($qian, $hou, $str); }
//$curl = &new Curl_HTTP_Client(); //$html_data = $curl->fetch_url("http://www.1395p.com/shishicai/"); $html_data = file_get_contents("http://www.1395p.com/shishicai/"); $html_data = trimall($html_data); $mode = "#<trclass='even'><td><pclass="p">(.?)</p><pclass="t">(.?)</p></td><tdclass="nums"><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.?)</span><spanclass='no[0-9]'>(.*?)</span></td>#"; preg_match_all($mode, $html_data, $arr); $html_data1 = $arr[0][0]; preg_match_all($mode, $html_data1, $arr1); echo "号码是:" . $hm1 = $arr1[3][0]; echo $hm2 = $arr1[4][0]; echo $hm3 = $arr1[5][0]; echo $hm4 = $arr1[6][0]; echo $hm5 = $arr1[7][0]; $num1 = $hm1; $num2 = $hm2; $num3 = $hm3; $num4 = $hm4; $num5 = $hm5; echo "期号是:" . $arr1[1][0]; $qishu = $arr[1][0]; $time = date('Y-m-d') . " " . $arr1[2][0]; echo "取出开奖时间:" . $time; echo "如不对,请修改数据库"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。