PageRenderTime 71ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/hphp/test/zend/bad/ext/curl/tests/curl_writeheader_callback.php

http://github.com/facebook/hiphop-php
PHP | 19 lines | 15 code | 4 blank | 0 comment | 2 complexity | 4a1e646b0e33d3a994c040918a9f4ff2 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. function curl_header_callback($curl_handle, $data)
  3. {
  4. if (strtolower(substr($data,0, 4)) == 'http')
  5. echo $data;
  6. }
  7. include 'server.inc';
  8. $host = curl_cli_server_start();
  9. $ch = curl_init();
  10. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  11. curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'curl_header_callback');
  12. curl_setopt($ch, CURLOPT_URL, $host);
  13. curl_exec($ch);
  14. curl_close($ch);
  15. ?>