Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 简单DOM文件\u get\u html返回空页面_Php - Fatal编程技术网

Php 简单DOM文件\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.

当我尝试此代码时,将复杂的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.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")