Так что я рабочий вариант графика, который я сделал с Charts API Google, и я выкладываю диаграммы данных/конфигурации, как это:Localhost Невозможно POST
$context = stream_context_create(
array('http' => array(
'method' => 'POST',
'content' => http_build_query($chart))));
fpassthru(fopen($url, 'r', false, $context));
Он отлично работает! Но когда я проверить это на моем локальном поле окна и попробуйте запустить его с 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
Я имел взгляд на мой файл php.ini на localbox и имеет это под Еореп обертки:
; 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
В чем проблема? Любой совет поможет Спасибо!
@Pete - независимо от ошибки, кажется, что 'fopen' работает так, как должно, и ваши настройки PHP верны. Проблема должна быть чем-то еще в данных, которые вы отправляете в API диаграмм. –
@Pete, тем не менее, код статуса [400] (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1) указывает, что Google отклоняет ваш URL/представление. – Rudu
В настоящее время это работает на сервере клиента, я сделал svn checkout из репозитория клиента, и он не работает из коробки, возможно, что-то еще проблема, потому что ребята –