curl_basic_005.phpt 778 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Test curl_opt() function with user agent
  3. --CREDITS--
  4. Sebastian Deutsch <sebastian.deutsch@9elements.com>
  5. TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
  6. --EXTENSIONS--
  7. curl
  8. --FILE--
  9. <?php
  10. include 'server.inc';
  11. $host = curl_cli_server_start();
  12. // start testing
  13. echo '*** Testing curl with user agent ***' . "\n";
  14. $url = "{$host}/get.inc?test=useragent";
  15. $ch = curl_init();
  16. ob_start(); // start output buffering
  17. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  18. curl_setopt($ch, CURLOPT_USERAGENT, 'cURL phpt');
  19. curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
  20. $curl_content = curl_exec($ch);
  21. curl_close($ch);
  22. var_dump( $curl_content );
  23. ?>
  24. --EXPECT--
  25. *** Testing curl with user agent ***
  26. string(9) "cURL phpt"