1--TEST--
2curl_error() function - basic test for curl_error using a fake url
3--CREDITS--
4Mattijs Hoitink mattijshoitink@gmail.com
5#Testfest Utrecht 2009
6--SKIPIF--
7<?php
8
9if (!extension_loaded("curl")) die("skip\n");
10
11$url = "fakeURL";
12$ip = gethostbyname($url);
13if ($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
28echo "== Testing curl_error with a fake URL ==\n";
29
30// cURL handler
31$ch = curl_init($url);
32curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
33
34curl_exec($ch);
35var_dump(curl_error($ch));
36curl_close($ch);
37
38?>
39--EXPECTF--
40== Testing curl_error with a fake URL ==
41string(%d) "%sfakeURL%S"
42