本地主机无法发布,我与谷歌图表API的图形的
问题描述:
所以我的工作版本,我张贴这样的图表数据/配置:本地主机无法发布,我与谷歌图表API的图形的
$context = stream_context_create(
array('http' => array(
'method' => 'POST',
'content' => http_build_query($chart))));
fpassthru(fopen($url, 'r', false, $context));
它的伟大工程!但是,当我检查出来我本地的Windows中,并尝试以XAMPP运行它,我得到这个错误:
Warning: fopen(http://chart.apis.google.com/chart?chid=982f36) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in C:\xampp\htdocs\graph\image.php on line 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="[email protected]"
; 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
这里有什么问题?任何建议将有助于谢谢!
答
它实际上在PHP方面工作得很好。采取这一网址,并贴到您的网页浏览器:
http://chart.apis.google.com/chart?chid=982f36
你会从谷歌说The Chart API request contains no valid parameters
得到400 Bad Request
错误页面。我对谷歌图表API一无所知,但似乎不能将参数正确传递给Google。
@Pete - 无论判断错误,它看起来像'fopen`正常工作,你的PHP设置是正确的。该问题必须是您发布到图表API的数据中的其他内容。 – 2011-02-01 16:07:00