curl_basic_011.phpt 688 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Test curl_opt() function with COOKIE
  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 cookie ***' . "\n";
  13. $url = "{$host}/get.inc?test=cookie";
  14. $ch = curl_init();
  15. ob_start(); // start output buffering
  16. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  17. curl_setopt($ch, CURLOPT_COOKIE, 'foo=bar');
  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 cookie ***
  25. string(3) "bar"