dongshuobei1037 2013-06-19 06:22
浏览 22

file_get_contents google app engine php

I am developing application on google app engine for php, I need to use file_get_contents to parse a website.

However, I met a problem from my server. For example, I run a single line of code like below:

<?php

    $html = file_get_contents('http://www.google.com');

?>

The server returns warnings and cannot execute what I plan to do.

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: A non-recoverable error occurred during a database lookup. in C:\gae_work\helloworld\helloworld.php on line 3

Warning: file_get_contents(http://www.google.com): failed to open stream: php_network_getaddresses: getaddrinfo failed: A non-recoverable error occurred during a database lookup. in C:\gae_work\helloworld\helloworld.php on line 3

Any similar experience? Please!

  • 写回答

2条回答 默认 最新

  • dou72260 2013-06-19 06:39
    关注

    Form Google App Engine Docs

    URL Fetch and the Development Server

    When your application is running in the development server on your computer, calls to the URL Fetch service are handled locally. The development server fetches URLs by contacting remote hosts directly from your computer, using whatever network configuration your computer is using to access the Internet.

    When testing the features of your app that fetch URLs, be sure that your computer can access the remote hosts.

    If your app is using the Google Secure Data Connector to access URLs on your intranet, be sure to test your app while connected to your intranet behind the firewall. Unlike App Engine, the development server does not use the SDC Agent to resolve intranet URLs. Only Google Apps and App Engine can authenticate with your SDC Agent.

    More : https://developers.google.com/appengine/docs/php/urlfetch/

    I think you need to check allow_url_fopen is open or not in your installation.

    评论

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了