function getTwitterIndexed($url) { $url = rtrim(JURI::root(), '/') . '/' . ltrim($url, '/'); $url = str_replace(array('http://', 'https://'), '', $url); if (substr($url, 0, 4) == 'www.') { $url = substr($url, 4); } $google_url = 'http://www.google.com/search?q="' . urlencode($url) . '"+site:' . urlencode('twitter.com'); $data = SEFTools::PostRequestFollowRedirects($google_url, null, null, 'get'); $matches = array(); if (preg_match('#<div[^>]*id="?resultStats"?>[^0-9]*([0-9,\\s]*)<#', html_entity_decode($data->content), $matches)) { return preg_replace('/[^0-9]/', '', $matches[1]); } return 0; }