qa:temp:ext:curl
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
qa:temp:ext:curl [2009/05/09 10:29] – created pajoye | qa:temp:ext:curl [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Place to document how to test cURL | + | ====== Testing the cURL extension ====== |
+ | |||
+ | How to test the cURL extension. | ||
+ | |||
+ | ===== With a webserver ===== | ||
+ | The cURL extensions tests can be run with the help of both a file on a webserver and a ftp server that can be reached by the machine the tests are run on. Environmental variables needs to be set as follows (on Unix):\\ | ||
+ | < | ||
+ | export PHP_CURL_HTTP_REMOTE_SERVER=http:// | ||
+ | export PHP_CURL_FTP_REMOTE_SERVER=" | ||
+ | export PHP_CURL_FTP_REMOTE_USER=" | ||
+ | export PHP_CURL_FTP_REMOTE_PASSWD=" | ||
+ | </ | ||
+ | Where http:// | ||
+ | |||
+ | The '' | ||
+ | |||
+ | ===== With a local file ===== | ||
+ | Some cURL tests work with a local file. The '' | ||
+ | |||
+ | The following piece of code is used to make sure a file is always present. | ||
+ | < | ||
+ | // Figure out what handler to use | ||
+ | if(!empty($_ENV[' | ||
+ | // Use the set Environment variable | ||
+ | $host = $_ENV[' | ||
+ | $url = " | ||
+ | } else { | ||
+ | // Create a temporary file for the test | ||
+ | $tempname = tempnam(sys_get_temp_dir(), | ||
+ | $url = ' | ||
+ | // add the test data to the file | ||
+ | file_put_contents($tempname, | ||
+ | } | ||
+ | |||
+ | /* .. your test .. */ | ||
+ | |||
+ | // Cleanup | ||
+ | isset( $tempname ) and unlink( $tempname ); | ||
+ | </ | ||
+ | |||
+ | When the '' |
qa/temp/ext/curl.1241864979.txt.gz · Last modified: 2017/09/22 13:28 (external edit)