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 10if(getenv("SKIP_ONLINE_TESTS")) die("skip online test"); 11if(getenv("SKIP_SLOW_TESTS")) die("skip slow test"); 12$url = "fakeURL"; 13$ip = gethostbyname($url); 14if ($ip != $url) die("skip 'fakeURL' resolves to $ip\n"); 15 16?> 17--FILE-- 18<?php 19/* 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