curl_basic_013.phpt 778 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Test curl_opt() function with CURLOPT_HTTP_VERSION/CURL_HTTP_VERSION_1_1
  3. --CREDITS--
  4. TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
  5. --EXTENSIONS--
  6. curl
  7. --FILE--
  8. <?php
  9. include 'server.inc';
  10. $host = curl_cli_server_start();
  11. // start testing
  12. echo '*** Testing curl with HTTP/1.1 ***' . "\n";
  13. $url = "{$host}/get.inc?test=httpversion";
  14. $ch = curl_init();
  15. ob_start(); // start output buffering
  16. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  17. curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  18. curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
  19. $curl_content = curl_exec($ch);
  20. curl_close($ch);
  21. var_dump( $curl_content );
  22. ?>
  23. --EXPECT--
  24. *** Testing curl with HTTP/1.1 ***
  25. string(8) "HTTP/1.1"