Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Use cURL instead of allow_url_fopen
Just a quick one:
Why not use cURL when testing if clean urls are working (diagnostics tab) instead of using the allow_url_fopen function.
allow_url_fopen is not supported by some hosts (i.e.. Dreamhost) for security reasons.
[?php
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, ‘http://example.com/clean_section/clean_article’);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
echo $file_contents;
?]
Offline
#2 2006-08-28 12:25:15
- scross
- Member
- Registered: 2006-01-17
- Posts: 13
Re: Use cURL instead of allow_url_fopen
Since you know the code why not implement it yourself
Offline
Re: Use cURL instead of allow_url_fopen
curl is not part of a default php distribution, it’s a special module that has to be installed. So that it isa lot less likely to be available than enabled url-wrappers for fopen.
Offline
Re: Use cURL instead of allow_url_fopen
The cURL library is almost always included with PHP as far as I know.
Offline
Re: Use cURL instead of allow_url_fopen
In my experience it is not.
Requirements
In order to use PHP’s CURL functions you need to install the libcurl package.[…]
Installation
To use PHP’s CURL support you must also compile PHP —with-curl[=DIR] where DIR is the location of the directory containing the lib and include directories.[…]
The debian-package does not include it by default either (though seperate packages are available).
If you were lucky enough only to be hosted where it was available, good for you. Yet it doesn’t mean it is the norm.
Last edited by Sencer (2006-08-28 23:06:24)
Offline
Re: Use cURL instead of allow_url_fopen
Ok, fair enough.
Offline
Pages: 1