示例#1
0
function process($like_object, $additional, $fbuid, $domain = NULL)
{
    global $conf;
    $domain = 'fxp.co.il -site:fxp.co.il/archive';
    //$domain = 'fxp.co.il/archive';
    //$domain = NULL;
    save_like($like_object, $additional, $fbuid);
    $translation = get_translation($like_object['id'], $like_object['name']);
    $query = '"' . $translation . '"';
    if ($translation == '') {
        $query = '"' . $like_object['name'] . '"';
    }
    if ($domain != NULL) {
        $query .= " site:" . $domain;
    }
    //get bing data
    $results = getBingData($query);
    //Add category data
    if (is_array($results)) {
        foreach ($results as $entry) {
            if (is_null($entry)) {
                continue;
            }
            //			var_dump($entry);
            $item = get_object_vars($entry);
            $item['url'] = $entry->Url;
            $res[] = $item;
        }
    } else {
        $res[] = 'empty';
    }
    save_bing($like_object['id'], $res, $domain);
    return $res;
}
示例#2
0
 $like_id = $row["like_id"];
 if ($result2 = $mysqli->query("SELECT * FROM likes WHERE like_id =" . $like_id . " and is_like_data=0")) {
     if ($result2->num_rows < 1) {
         continue;
     }
     if ($i++ > $stop_at) {
         exit;
     }
     $like = $result2->fetch_object();
     //echo $i . ") " . $like->like_name . "<br>";
     $like_data = json_decode(file_get_contents("https://graph.facebook.com/" . $like->like_id), true);
     $like_id = $like->like_id;
     if ($like_data) {
         //check and save in mongo +
         $add = array();
         save_like($like_data, $add, $like_id, true);
         $mysqli->query("UPDATE likes SET is_like_data=1 WHERE like_id={$like_id}");
         $like_data_id = $like_data->id;
         $like_data_name = $like_data["name"];
         $like_data_link = $like_data["link"];
         $like_data_likes = $like_data["likes"];
         $like_data_cat = $like_data["category"];
         $like_data_talking = $like_data["talking_about_count"];
         if (!isset($like_data_cat) or $like_data_cat == "") {
             $like_data_cat = "No Category";
         }
         if (!isset($like_data_talking) or $like_data_talking == "") {
             $like_data_talking = 0;
         }
         if (!isset($like_data_likes) or $like_data_likes == "") {
             $like_data_likes = 0;