curl_basic_013.phpt 1017 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. --SKIPIF--
  6. <?php include 'skipif.inc'; ?>
  7. --FILE--
  8. <?php
  9. /* Prototype : bool curl_setopt(resource ch, int option, mixed value)
  10. * Description: Set an option for a cURL transfer
  11. * Source code: ext/curl/interface.c
  12. * Alias to functions:
  13. */
  14. include 'server.inc';
  15. $host = curl_cli_server_start();
  16. // start testing
  17. echo '*** Testing curl with HTTP/1.1 ***' . "\n";
  18. $url = "{$host}/get.php?test=httpversion";
  19. $ch = curl_init();
  20. ob_start(); // start output buffering
  21. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  22. curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  23. curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
  24. $curl_content = curl_exec($ch);
  25. curl_close($ch);
  26. var_dump( $curl_content );
  27. ?>
  28. ===DONE===
  29. --EXPECTF--
  30. *** Testing curl with HTTP/1.1 ***
  31. string(8) "HTTP/1.1"
  32. ===DONE===