Beispiel #1
0
 public function test_curl_debugging()
 {
     $this->assertEmptyPool();
     $fp = fopen('php://memory', 'w+');
     $options = array(CURLOPT_STDERR => $fp, CURLOPT_VERBOSE => true);
     $response = Curl::get('http://bfanger.nl/', $options);
     $this->assertSame($response->http_code, 200);
     rewind($fp);
     $log = stream_get_contents($fp);
     $response->on('closed', function () use($fp) {
         fclose($fp);
     });
     $this->assertTrue(strstr($log, '< HTTP/1.1 200 OK') !== false, 'Use CURLOPT_VERBOSE should write to the CURLOPT_STDERR');
 }