* require_once 'HTTP/Request2.php'; * require_once 'HTTP/Request2/Observer/UncompressingDownload.php'; * * #$inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html'; * #$inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on'; * $inPath = 'http://carsten.codimi.de/gzip.yaws/daniels.html?deflate=on&zlib=on'; * #$outPath = "/dev/null"; * $outPath = "delme"; * * $stream = fopen($outPath, 'wb'); * if (!$stream) { * throw new Exception('fopen failed'); * } * * $request = new HTTP_Request2( * $inPath, * HTTP_Request2::METHOD_GET, * array( * 'store_body' => false, * 'connect_timeout' => 5, * 'timeout' => 10, * 'ssl_verify_peer' => true, * 'ssl_verify_host' => true, * 'ssl_cafile' => null, * 'ssl_capath' => '/etc/ssl/certs', * 'max_redirects' => 10, * 'follow_redirects' => true, * 'strict_redirects' => false * ) * ); * * $observer = new HTTP_Request2_Observer_UncompressingDownload($stream, 9999999); * $request->attach($observer); * * $response = $request->send(); * * fclose($stream); * echo "OK\n"; *