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--
|
2011-09-01 00:45:56 +00:00
|
|
|
<?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);
|
2011-09-01 00:45:56 +00:00
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
2009-07-03 00:09:08 +00:00
|
|
|
|
|
|
|
curl_exec($ch);
|
2011-09-01 00:45:56 +00:00
|
|
|
var_dump(curl_error($ch));
|
2009-07-03 00:09:08 +00:00
|
|
|
curl_close($ch);
|
|
|
|
|
|
|
|
?>
|
2011-09-01 00:45:56 +00:00
|
|
|
--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"
|