Annotation of embedaddon/php/ext/curl/tests/curl_error_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: curl_error() function - basic test for curl_error using a fake url
! 3: --CREDITS--
! 4: Mattijs Hoitink mattijshoitink@gmail.com
! 5: #Testfest Utrecht 2009
! 6: --SKIPIF--
! 7: <?php
! 8:
! 9: if (!extension_loaded("curl")) die("skip\n");
! 10:
! 11: $url = "fakeURL";
! 12: $ip = gethostbyname($url);
! 13: if ($ip != $url) die("skip 'fakeURL' resolves to $ip\n");
! 14:
! 15: ?>
! 16: --FILE--
! 17: <?php
! 18: /*
! 19: * Prototype: string curl_error(resource $ch)
! 20: * Description: Returns a clear text error message for the last cURL operation.
! 21: * Source: ext/curl/interface.c
! 22: * Documentation: http://wiki.php.net/qa/temp/ext/curl
! 23: */
! 24:
! 25: // Fake URL to trigger an error
! 26: $url = "fakeURL";
! 27:
! 28: echo "== Testing curl_error with a fake URL ==\n";
! 29:
! 30: // cURL handler
! 31: $ch = curl_init($url);
! 32: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
! 33:
! 34: curl_exec($ch);
! 35: var_dump(curl_error($ch));
! 36: curl_close($ch);
! 37:
! 38: ?>
! 39: --EXPECTF--
! 40: == Testing curl_error with a fake URL ==
! 41: string(%d) "%sfakeURL%s"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>