Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.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简单html dom传递url问题_Php_Angularjs_Url_Simple Html Dom - Fatal编程技术网

PHP简单html dom传递url问题

PHP简单html dom传递url问题,php,angularjs,url,simple-html-dom,Php,Angularjs,Url,Simple Html Dom,我的问题是:我试图通过angular将字符串形式的URL传递给PHP,如下所示: $http({ method: "POST", url: "contentParser.php", data: { data: "http://www.google.com" } }).success(function(response) { $log.log(response); th

我的问题是:我试图通过angular将字符串形式的URL传递给PHP,如下所示:

 $http({
        method: "POST",
        url: "contentParser.php",
        data: {
            data: "http://www.google.com"
        }
    }).success(function(response) {
        $log.log(response);
        this.article = response;
    }).error(function(response) {
        console.log(response);
    });
该字符串可以很好地访问PHP,但是如果我尝试将load_file与该字符串一起使用,如下所示:

<?php
    include('simple_html_dom.php');
    $html = new simple_html_dom();
    $data = json_decode(file_get_contents("php://input"));
    $html->load_file($data->data);
    echo $html;
?>
并添加到加载_文件时,我收到以下错误:

警告:文件获取内容(http%3A%2F%2Fwww.google.com):无法打开流:中没有此类文件或目录

我试过: 在/NoDecode上添加allowencodedslash, 将%3A替换为:并将%2F替换为/(可能我做错了?)


老实说,我已经智穷了。感谢您的帮助。

首先,AFAIK google正在使用SSL,所以应该是
https
我猜错误消息指向您没有发布的文件和行。您是否可以更新您的问题以包括实际导致错误的代码行(以及之前的几行代码)?您可能在调用其他函数调用失败的结果时调用了
innertext()
。编辑了问题并添加了PHP代码。对于其他存在此问题的人,我找到了一个解决方法:不使用
$html=new simple_html_dom()$html->load_file()
,使用
$html=file_get_html('url')
似乎可以做到这一点。我不太清楚这是怎么回事,也许更聪明的人可以解释一下?首先,AFAIK google正在使用SSL,所以应该是
https
,我猜错误消息指向一个你没有发布的文件和行。您是否可以更新您的问题以包括实际导致错误的代码行(以及之前的几行代码)?您可能在调用其他函数调用失败的结果时调用了
innertext()
。编辑了问题并添加了PHP代码。对于其他存在此问题的人,我找到了一个解决方法:不使用
$html=new simple_html_dom()$html->load_file()
,使用
$html=file_get_html('url')
似乎可以做到这一点。不太清楚这是怎么回事,也许有更聪明的人可以解释?
$url = urlencode($data->data);