Php 本地主机无法发布

Php 本地主机无法发布,php,xampp,fopen,Php,Xampp,Fopen,因此,我有一个使用Google Charts API制作的图形的工作版本,我发布的图表数据/配置如下: $context = stream_context_create( array('http' => array( 'method' => 'POST', 'content' => http_build_query($chart)))); fpassthru(fopen($url, 'r', false, $context)); 它工作

因此,我有一个使用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运行它时,会出现以下错误:

警告: fopenhttp://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

这里有什么问题?任何建议都会有帮助的,谢谢

从PHP的角度来看,它实际上工作得很好。获取该URL并将其粘贴到web浏览器中:


您将从Google获得一个400错误请求页面,指出Chart API请求不包含有效参数。我对Google charts API一无所知,但似乎您一定没有正确地将参数传递给Google。

@Pete-不管从错误判断,fopen似乎正常工作,您的PHP设置也正确。问题一定是您发布到charts API的数据中存在其他问题。@Pete无论如何,状态代码为表示Google拒绝您的URL/提交。这目前正在客户端服务器上运行,我从客户端存储库中执行了svn签出,但无法立即执行,也许还有别的问题谢谢大家