그래서 내가 작업 한 버전을 게시 할 수 없습니다, 나는이 같은 차트 데이터/구성 게시 :로컬 호스트 내가 구글 차트 API로 만든 그래프의
$context = stream_context_create(
array('http' => array(
'method' => 'POST',
'content' => http_build_query($chart))));
fpassthru(fopen($url, 'r', false, $context));
그것은 잘 작동합니다! 내 로컬 Windows 상자를 확인하고 XAMPP 그것을 실행하려고 할 때이 오류가 얻을 : 나는 localbox를 내 php.ini 파일에서보고 있었다
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
을 그리고 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
여기에는 어떤 문제가있을 수 있습니까? 어떤 조언을 해 주셔서 감사합니다!
@Pete - 오류 여부에 관계없이 'fopen'이 정상적으로 작동하고 PHP 설정이 올바른 것처럼 보입니다. 문제는 차트 API에 게시하는 데이터의 다른 내용이어야합니다. –
@Pete 결코 적은, [400] (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1)의 상태 코드는 Google이 귀하의 URL/제출을 거부하고 있음을 나타냅니다. – Rudu
이것은 현재 클라이언트의 서버에서 작업 중이며 클라이언트의 저장소에서 svn 체크 아웃을 수행했으며 상자에서 작동하지 않습니다. 아마도 다른 것이 문제가됩니다. 감사합니다. –