以下の現象について原因と対応方法をご存知の方、知見をいただけると幸いです。
- Windows 10で発生します。
PHPからcURL(POST)で開発システムの特定のパスへアクセスすると「Problem (2) in the Chunked-Encoded data」が発生します。
ただし、cURLの実行前に以下のようにexec('curl -V');
を実行すると発生しなくなります。 - Linux(CentOS 7)では、
exec('curl -V');
を実行しなくても上記エラーは発生しません。
PHP
1 $ch = curl_init(); 2 curl_setopt( $ch, CURLOPT_URL, $url ); 3 curl_setopt( $ch, CURLOPT_POST, true); 4 curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($params)); 5 curl_setopt( $ch, CURLOPT_TIMEOUT, 60); 6 curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); 7 curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); 8 9 if (preg_match('/\A.*/<特定のパス>\z/', $url)) { // ←★追加 10 exec('curl -V'); // ←★追加 11 } // ←★追加 12 $response = curl_exec($ch); 13 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
環境
- OS: Windows 10 Pro(バージョン: 1809、OSビルド: 17763.437)
- Nginx: 1.10.3
- Apache httpd: 2.2.34(Linuxの場合は2.2.32)
- PHP: 5.3.29
- FuelPHP: 1.7.0
- cURL: 下記
cURLのバージョン確認
>curl -V curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL Release-Date: [unreleased] Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL
>where curl C:\Windows\System32\curl.exe
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/09/26 00:35
2019/09/26 08:17