php-src/ext/curl/tests/curl_error_basic.phpt

42 lines
904 B
Plaintext
Raw Normal View History

2009-07-03 00:09:08 +00:00
--TEST--
curl_error() function - basic test for curl_error using a fake url
--CREDITS--
Mattijs Hoitink mattijshoitink@gmail.com
#Testfest Utrecht 2009
--SKIPIF--
<?php
if (!extension_loaded("curl")) die("skip\n");
$url = "fakeURL";
$ip = gethostbyname($url);
if ($ip != $url) die("skip 'fakeURL' resolves to $ip\n");
?>
2009-07-03 00:09:08 +00:00
--FILE--
<?php
/*
* Prototype: string curl_error(resource $ch)
* Description: Returns a clear text error message for the last cURL operation.
* Source: ext/curl/interface.c
* Documentation: http://wiki.php.net/qa/temp/ext/curl
*/
// Fake URL to trigger an error
$url = "fakeURL";
echo "== Testing curl_error with a fake URL ==\n";
// cURL handler
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
2009-07-03 00:09:08 +00:00
curl_exec($ch);
var_dump(curl_error($ch));
2009-07-03 00:09:08 +00:00
curl_close($ch);
?>
--EXPECTF--
2009-07-03 00:09:08 +00:00
== Testing curl_error with a fake URL ==
2013-02-19 08:04:06 +00:00
string(%d) "%sfakeURL%S"