function social_hashtag_run_request()
{
    social_hashtag_logging('Start - run manually', 2);
    $social_hashtag_cache = new SOCIAL_HASHTAG_CACHE();
    if (!empty($_REQUEST['debug'])) {
        $social_hashtag_cache->debug = true;
    }
    $results = $social_hashtag_cache->run_social_hashtag_query($_REQUEST['num']);
    print json_encode(array('success' => true, 'message' => $results));
    social_hashtag_logging('End - run manually: ' . $results, 2);
    die;
}
 function run_social_hashtag_query($num = 0)
 {
     $global_options = $this->get_social_hashtag_options(null, 'global');
     $all_api_options = $this->get_social_hashtag_options();
     $platform_options = $all_api_options[$num];
     $platform = $this->choose_platform($platform_options['api_selected']);
     $search_url = $this->build_api_search_url($num);
     $count_items = 0;
     $results = "";
     while (strlen($search_url) > 10) {
         if (!empty($global_options['debug_on'])) {
             social_hashtag_logging('API url: ' . $search_url, 1);
         }
         if ($platform_options['api_selected'] == "twitter") {
             $json_string = $this->oauth($search_url);
             $json_string = utf8_encode($json_string);
             $json_string = html_entity_decode($json_string);
             $response = json_decode($json_string);
             $photos = $platform->clean_response($response);
         } else {
             $json_string = $this->remote_get_contents($search_url);
             $response = json_decode($json_string);
             $photos = $platform->clean_response($response);
         }
         if (!is_array($photos)) {
             return "No results found";
             break;
         }
         if (!empty($global_options['debug_on'])) {
             social_hashtag_logging('total items returned from API: ' . count($photos), 1);
         }
         $results .= $this->import_item($photos, $platform, $platform_options, $global_options);
         $count_items = count($photos) + $count_items;
         if ($count_items > $global_options['max_items'] && $global_options['max_items']) {
             if (!empty($global_options['debug_on'])) {
                 social_hashtag_logging('Max results settings hit: ' . $global_options['max_items'], 1);
             }
             break;
         }
         $platform->get_next_page($response, $search_url);
         $search_url = $platform->next_page;
     }
     return $results;
 }