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--EXTENSIONS--
7curl
8--SKIPIF--
9<?php
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 * Description:   Returns a clear text error message for the last cURL operation.
20 * Source:        ext/curl/interface.c
21 * Documentation: http://wiki.php.net/qa/temp/ext/curl
22 */
23
24// Fake URL to trigger an error
25$url = "fakeURL";
26
27echo "== Testing curl_error with a fake URL ==\n";
28
29// cURL handler
30$ch = curl_init($url);
31curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
32
33curl_exec($ch);
34var_dump(curl_error($ch));
35curl_close($ch);
36
37?>
38--EXPECTF--
39== Testing curl_error with a fake URL ==
40string(%d) "%sfakeURL%S"
41