【发布时间】:2017-08-24 08:58:02
【问题描述】:
我有一些 PHP 代码在本地和 Web 中都能完美运行(使用非 SSL 托管)。我使用file_get_html(url) 获取文件内容,一切正常。
当我尝试在 Google App Engine 中运行此代码时出现问题。 file_get_html() 函数不起作用。
以下代码在 BEGIN 和 END 之间没有显示任何内容:
<?php
header("Access-Control-Allow-Origin: *");
include './simple_html_dom.php';
$sitioweb = file_get_html("http://www.bolsamadrid.es/esp/aspx/Mercados/Precios.aspx?indice=ESI100000000");
echo "BEGIN<hr>";
echo $sitioweb;
echo "<hr>END";
任何帮助将不胜感激!
【问题讨论】:
-
当我在这个网站上查看 simplehtmldom.sourceforge.net 他们给出这个代码来转储 html "file_get_html('foo')->plaintext;"所以也许 $sitioweb->plaintext 会起作用?
-
在本地工作,但不能在 Google App Engine 中工作。问题不在于 simple_html_dom 库,我有很多员工在处理它;问题是我无法在 App Engine 中使用它,因为我无法获取外部网络的内容。
-
如果你只做一个 file_get_content 会发生什么?
-
file_get_content 在应用程序中也不起作用 :-(
-
那是google app engine的设置问题,你没有报错吧?
标签: php google-app-engine google-cloud-platform