curl_basic_010.phpt 726 B

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