curl_basic_010.phpt 719 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Test curl_error() & curl_errno() function with problematic proxy
  3. --CREDITS--
  4. TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
  5. --SKIPIF--
  6. <?php
  7. if (!extension_loaded("curl")) print "skip";
  8. $addr = "www.".uniqid().".".uniqid();
  9. if (gethostbyname($addr) != $addr) {
  10. print "skip catch all dns";
  11. }
  12. ?>
  13. --FILE--
  14. <?php
  15. $url = "http://www.example.org";
  16. $ch = curl_init();
  17. curl_setopt($ch, CURLOPT_PROXY, uniqid().":".uniqid());
  18. curl_setopt($ch, CURLOPT_URL, $url);
  19. curl_exec($ch);
  20. var_dump(curl_error($ch));
  21. var_dump(curl_errno($ch));
  22. curl_close($ch);
  23. ?>
  24. --EXPECTF--
  25. %unicode|string%(%d) "%r(Couldn't resolve proxy|Could not resolve proxy:|Could not resolve host:|Could not resolve:)%r %s"
  26. int(5)