curl_setopt_basic003.phpt 889 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. curl_setopt() call with CURLOPT_HTTPHEADER
  3. --CREDITS--
  4. Paul Sohier
  5. #phptestfest utrecht
  6. --SKIPIF--
  7. <?php include 'skipif.inc'; ?>
  8. --FILE--
  9. <?php
  10. include 'server.inc';
  11. $host = curl_cli_server_start();
  12. // start testing
  13. echo "*** curl_setopt() call with CURLOPT_HTTPHEADER\n";
  14. $url = "{$host}/";
  15. $ch = curl_init();
  16. curl_setopt($ch, CURLOPT_HTTPHEADER, 1);
  17. $curl_content = curl_exec($ch);
  18. curl_close($ch);
  19. var_dump( $curl_content );
  20. $ch = curl_init();
  21. ob_start(); // start output buffering
  22. curl_setopt($ch, CURLOPT_HTTPHEADER, array());
  23. curl_setopt($ch, CURLOPT_URL, $host);
  24. $curl_content = curl_exec($ch);
  25. ob_end_clean();
  26. curl_close($ch);
  27. var_dump( $curl_content );
  28. ?>
  29. --EXPECTF--
  30. *** curl_setopt() call with CURLOPT_HTTPHEADER
  31. Warning: curl_setopt(): You must pass either an object or an array with the CURLOPT_HTTPHEADER argument in %s on line %d
  32. bool(false)
  33. bool(true)