qa:temp:ext:curl
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
qa:temp:ext:curl [2009/05/09 10:59] – first version mattijs | qa:temp:ext:curl [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 4: | Line 4: | ||
===== With a webserver ===== | ===== With a webserver ===== | ||
- | The cURL extensions tests can be run with the help of a file on a webserver that can be reached by the machine the tests are run on. An environmental variable pointing to the host needs to be set as follows (on Unix):\\ | + | The cURL extensions tests can be run with the help of both a file on a webserver |
- | < | + | < |
+ | 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:// | Where http:// | ||
- | The file that is requisted | + | The '' |
===== With a local file ===== | ===== With a local file ===== | ||
- | ToDo | + | 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.1241866742.txt.gz · Last modified: 2017/09/22 13:28 (external edit)