Php 简单DOM文件\u get\u html返回空页面
当我尝试此代码时,将复杂的url传递到文件\u get\u html时遇到问题Php 简单DOM文件\u get\u html返回空页面,php,Php,当我尝试此代码时,将复杂的url传递到文件\u get\u html时遇到问题 <?php require_once("$_SERVER[DOCUMENT_ROOT]/dom/simple_html_dom.php"); $base = $_GET['url']; //file_get_contents() reads remote webpage content $html_base = file_get_html("http://www.realestateinvestar.
<?php
require_once("$_SERVER[DOCUMENT_ROOT]/dom/simple_html_dom.php");
$base = $_GET['url'];
//file_get_contents() reads remote webpage content
$html_base = file_get_html("http://www.realestateinvestar.com.au/ME2/dirmod.asp?sid=1A0FFDB3E8CD48909120C118D03F6016&nm=&type=news&mod=News&mid=9A02E3B96F2A415ABC72CB5F516B4C10&tier=3&nid=C67A9DD2C0144B9EB41DB58365C05927");
foreach($html_base->find('p') as $td) {
echo $td;
}
?>
它返回一个空白页
有什么帮助吗?使用:
是否需要_once($_SERVER[DOCUMENT\u ROOT]/dom/simple\u html\u dom.php)代码>甚至可以按预期工作?我会尝试require_一次($_SERVER['DOCUMENT_ROOT']。“/dom/simple_html_dom.php”)代码>不,这不是问题,代码的第一部分使用require\u once($\u SERVER[DOCUMENT\u ROOT]/dom/simple\u html\u dom.php”);,代码的第二部分不检查$base
变量。
<?php
require_once("$_SERVER[DOCUMENT_ROOT]/dom/simple_html_dom.php");
$base = $_GET['url'];
//file_get_contents() reads remote webpage content
$html_base = file_get_html($base);
foreach($html_base->find('p') as $td) {
echo $td;
}
?>
"mysite.com/goget.php?url="
.urlencode("http://www.realestateinvestar.com.au/ME2/dirmod.asp?sid=1A0FFDB3E8CD48909120C118D03F6016&nm=&type=news&mod=News&mid=9A02E3B96F2A415ABC72CB5F516B4C10&tier=3&nid=C67A9DD2C0144B9EB41DB58365C05927")