I have added the folowing as replace for "file_get_contents()":
PHP Code:
function ame_random_useragent() {
$uas = array();
$uas[] = 'SonyEricssonP900/R102 Profile/MIDP-2.0 Configuration/CLDC-1.0 Rev/MR4';
$uas[] = 'FireFox (X11; Linux i686; pl-PL); slackware; FireFox;';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; FastWeb; Windows NT 5.1; OMEGA)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ';
$uas[] = 'Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101 ';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.2; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 6.0)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
$uas[] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
return $uas[array_rand($uas,1)];
}
function ame_get_ips() {
$ips = array(
array('66.197.xxx.xxx',ame_random_useragent()),
array('66.197.xxx.xxx',ame_random_useragent()),
array('66.197.xxx.xxx',ame_random_useragent()),
array('66.197.xxx.xxx',ame_random_useragent()),
array('66.197.xxx.xxx',ame_random_useragent()),
array('66.197.xxx.xxx',ame_random_useragent()),
array('66.197.xxx.xxx',ame_random_useragent())
);
return $ips;
}
function ame_get_conents($url) {
$ips = ame_get_ips();
$ip = $ips[array_rand($ips,1)];
$ch = curl_init();
curl_setopt($ch, CURLOPT_INTERFACE, $ip[0]);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 50);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $ip[1]);
if ($referer!='') {
#curl_setopt($ch, CURLOPT_REFERER, $referer);
}
$return_data = curl_exec($ch);
curl_close($ch);
return $return_data;
}
Note the timeout option to bypass the vBulletin BBCode parse timeout, if it exists. So far it seems to work again, when the title fetching fails just the AME bbcode remains unparsed and not a part of the other BBCode.