【发布时间】:2011-02-01 15:58:18
【问题描述】:
所以我有一个使用 Google Charts API 制作的图表的工作版本,我发布了这样的图表数据/配置:
$context = stream_context_create(
array('http' => array(
'method' => 'POST',
'content' => http_build_query($chart))));
fpassthru(fopen($url, 'r', false, $context));
效果很好!但是当我在本地 Windows 框中检查它并尝试使用 Xampp 运行它时,我收到了这个错误:
警告: fopen(http://chart.apis.google.com/chart?chid=982f36) [function.fopen]:打开失败 流:HTTP 请求失败! HTTP/1.0 400 错误请求 C:\xampp\htdocs\graph\image.php 在第 226 行
我在 localbox 上查看了我的 php.ini 文件,它在 fopen 包装器下有这个:
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-fopen
allow_url_fopen = On
; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-include
allow_url_include = Off
; Define the anonymous ftp password (your email address). PHP's default setting
; for this is empty.
; http://php.net/from
;from="john@doe.com"
; Define the User-Agent string. PHP's default setting for this is empty.
; http://php.net/user-agent
;user_agent="PHP"
; Default timeout for socket based streams (seconds)
; http://php.net/default-socket-timeout
default_socket_timeout = 60
; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; http://php.net/auto-detect-line-endings
;auto_detect_line_endings = Off
这可能是什么问题?任何建议都会有所帮助谢谢!
【问题讨论】: