function getMentionsArray($id_profile, $count = 10)
{
    $mentions = array();
    $qry = ' SELECT screen_name AS name, count(*) AS count
                    FROM ' . DB_TWITTER_PREFIX . 'mentions
                    WHERE owloo_user_id = $1 AND type_tweet = 1
                    GROUP BY screen_name
                    ORDER BY count DESC
                    LIMIT 0 , $2;';
    $que = db_query_tw($qry, array($id_profile, $count));
    while ($fila = mysql_fetch_assoc($que)) {
        $fila['picture'] = get_current_picture_profile($fila['name']);
        $mentions[] = $fila;
    }
    return $mentions;
}
function get_url_content($url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return (double) $usec + (double) $sec;
}
function get_current_picture_profile($username)
{
    $html = get_url_content('http://instagram.com/' . $username);
    $doc = new DOMDocument();
    $doc->loadHTML($html);
    foreach ($doc->getElementsByTagName('meta') as $meta) {
        if ($meta->getAttribute('property') == 'og:image') {
            if ($meta->getAttribute('content') != '') {
                return $meta->getAttribute('content');
            }
        }
    }
    return 'http://a0.twimg.com/sticky/default_profile_images/default_profile_5_200x200.png';
}
$time_start = microtime_float();
get_current_picture_profile('cristiano');
echo 'Time: ' . (microtime_float() - $time_start);
function getMentionsArray($id_profile, $count = 10)
{
    $mentions = array();
    $qry = ' SELECT mention name, count(*) AS count
                    FROM ' . DB_INSTAGRAM_PREFIX . 'media_mentions
                    WHERE id_profile = $1
                    GROUP BY mention
                    ORDER BY count DESC
                    LIMIT 0 , $2;';
    $que = db_query($qry, array($id_profile, $count));
    while ($fila = mysql_fetch_assoc($que)) {
        $fila['picture'] = get_current_picture_profile($fila['name']);
        $mentions[] = $fila;
    }
    return $mentions;
}