View Full Version : Include a Curl version of import.php
mike390
11-26-2006, 08:28 AM
For us and the others who will use this script compuned with dreamhost and other hosts who dont allow fopen, you could also include a curl version of import.php especially for those who cant code too well, if at all.
blank
11-26-2006, 04:29 PM
I just haven't had a chance to read up on curl yet, I plan on doing it because I know alot of people do use dreamhost.
mike390
11-26-2006, 09:21 PM
ive gotten help converting the import.php to use curl, i dont know much on it either but i can give you what i have so far to help you out if you want, ill post it tomorrow when i have more time
mike390
11-27-2006, 04:30 PM
Create a nep file calles class.curl.php and pase the following code in it
<?php
class CURL {
var $ch;
function CURL () {
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($this->ch, CURLOPT_COOKIEFILE, 'cookie.txt');
}
function request($method, $url, $vars) {
curl_setopt($this->ch, CURLOPT_URL, $url);
if ($method == 'POST') {
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $vars);
}
$data = curl_exec($this->ch);
if ($data) {
return $data;
} else {
return curl_error($this->ch);
}
}
function get($url) {
return $this->request('GET', $url, 'NULL');
}
}
$curl = &new CURL();
?>
inside import.php include class.curl.php
include("class.curl.php");
and replace file_get_contents with
$curl->get
blank
11-28-2006, 05:05 PM
thanks, I just noticed this post!
I'll take it a step further and put a check in place and have that automatically used if the check fails ;)
mike390
11-28-2006, 05:17 PM
thats an awsome idea blank
blank
11-28-2006, 08:45 PM
hey mike can you email me the import.php you're using? I don't have CURL installed so I can't test it properly without recompiling...
admin@iamnotageek.com is my primary email.
mike390
11-28-2006, 09:22 PM
ive emailed you my import.php, class.curl.php and image_fix.php since i changed that too, from cabralm (at] gmail.com
blank
11-28-2006, 09:36 PM
I got it, thanks... just uploaded import.zip with a $usecurl variable.
mike390
11-28-2006, 09:44 PM
nice, lol now dreamhost works for everyone
bilzmoney
12-01-2006, 05:14 AM
hi am nas i am a new member
vBulletin® v3.7.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.