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 11:39] – Added file fallback proposal dynom | 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 ===== | ||
- | Proposal for file fallback. | + | Some cURL tests work with a local file. The '' |
+ | |||
+ | The following piece of code is used to make sure a file is always present. | ||
< | < | ||
- | if ( ! empty($_ENV[' | + | // Figure out what handler to use |
- | $host = $_ENV[' | + | if(!empty($_ENV[' |
+ | // Use the set Environment variable | ||
+ | | ||
+ | $url = " | ||
} else { | } else { | ||
- | | + | // Create a temporary file for the test |
- | $host = ' | + | |
+ | $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.1241869197.txt.gz · Last modified: 2017/09/22 13:28 (external edit)