bug55767.phpt 1000 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test curl_opt() function with POST params from array with a numeric key
  3. --EXTENSIONS--
  4. curl
  5. --FILE--
  6. <?php
  7. include 'server.inc';
  8. $host = curl_cli_server_start();
  9. // start testing
  10. echo '*** Testing curl sending through GET an POST ***' . "\n";
  11. $url = "{$host}/get.inc?test=getpost&get_param=Hello%20World";
  12. $ch = curl_init();
  13. ob_start(); // start output buffering
  14. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  15. curl_setopt($ch, CURLOPT_POST, 1);
  16. curl_setopt($ch, CURLOPT_POSTFIELDS, array('Hello'=>'World','Foo'=>'Bar',100=>'John Doe'));
  17. curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
  18. $curl_content = curl_exec($ch);
  19. curl_close($ch);
  20. var_dump( $curl_content );
  21. ?>
  22. --EXPECT--
  23. *** Testing curl sending through GET an POST ***
  24. string(203) "array(2) {
  25. ["test"]=>
  26. string(7) "getpost"
  27. ["get_param"]=>
  28. string(11) "Hello World"
  29. }
  30. array(3) {
  31. ["Hello"]=>
  32. string(5) "World"
  33. ["Foo"]=>
  34. string(3) "Bar"
  35. [100]=>
  36. string(8) "John Doe"
  37. }
  38. "