Exemplo n.º 1
0
 function googleUrlShort()
 {
     $this->load->library('UrlShortner');
     $key = 'AIzaSyAN2hEVTtDDuQp7qKrB-A8rVNenFf5m4C4';
     $googer = new GoogleURLAPI($key);
     $shortDWName = $googer->shorten("http://davidwalsh.name");
     var_dump($shortDWName);
     // returns http://goo.gl/i002
     //echo $shortDWName;
 }
Exemplo n.º 2
0
Arquivo: aaa.php Projeto: ram-1501/rs
     }
     break;
 case 'shorten_url':
     if (isset($_POST['url'])) {
         $googer = new GoogleURLAPI();
         $shortDWName = $googer->shorten($_POST['url']);
         echo $shortDWName ? $shortDWName : 'error';
         // returns http://goo.gl/i002
     } else {
         echo 'error';
     }
     break;
 case 'url_info':
     if (isset($_POST['url'])) {
         echo $_POST['url'];
         $googer = new GoogleURLAPI();
         $longDWName = $googer->analytics($_POST['url']);
         echo $longDWName;
     } else {
         echo 'error';
     }
     break;
 case 'sort_fallback':
     if (isset($_POST['data'])) {
     } else {
         echo 'error';
     }
     break;
 case 'publishWidget':
     if (isset($_POST['data'])) {
         // echo $_POST['data']['wix_id'];
Exemplo n.º 3
0
/**
 * shorturl_url($url, $api=null)
 * used to shorten a url
 */
function shorturl_url($url, $api = null)
{
    global $settings;
    if (is_null($api)) {
        if ($settings['SET_SHORT_URL_API'] == 'b54') {
            $api = 'yourls';
            $settings['SET_SHORT_URL_API_URL'] = 'http://www.b54.in/api/';
        } else {
            $api = $settings['SET_SHORT_URL_API'];
        }
    }
    switch ($api) {
        case 'yourls':
            $api_url = sprintf($settings['SET_SHORT_URL_API_URL'] . '?username=%s&password=%s&url=%s&format=text&action=shorturl&source=plugin', $settings['SET_SHORT_URL_USER'], $settings['SET_SHORT_URL_PASS'], urlencode($url));
            $shorturl = file_get_contents($api_url);
            break;
        case 'bitly':
            $api_url = sprintf('http://api.bit.ly/v3/shorten?longUrl=%s&login=%s&apiKey=%s&format=xml', urlencode($url), $settings['SET_SHORT_URL_USER'], $settings['SET_SHORT_URL_PASS']);
            $shorturl = shorturl_url_xml($api_url, '!<url>[^<]+</url>');
            break;
        case 'tinyurl':
            $api_url = sprintf('http://tinyurl.com/api-create.php?url=%s', urlencode($url));
            $shorturl = shorturl_url_simple($api_url);
            break;
        case 'isgd':
            $api_url = sprintf('http://is.gd/api.php?longurl=%s', urlencode($url));
            $shorturl = shorturl_url_simple($api_url);
            break;
        case 'googl':
            require CFLIBPATH . 'goo.class.php';
            $googer = new GoogleURLAPI($settings['SET_SHORT_URL_PASS']);
            $shorturl = $googer->shorten($url);
            break;
        default:
            $shorturl = '';
    }
    return $shorturl;
}
Exemplo n.º 4
0
<?php

/**
 * Refer a friend
 *
 * Shows the page to refer a friend
 */
global $woocommerce, $swr_settings, $refer_message, $refer_option, $post;
$googer = new GoogleURLAPI();
$c_lang = str_replace('-', '_', get_bloginfo('language'));
$langs = explode('_', $c_lang);
$s_lang = $langs[0];
$c_link = get_bloginfo("url") . '?ref=' . get_current_user_id();
$short_link = $googer->shorten($c_link);
?>

<?php 
if ($refer_option == 1) {
    ?>
<form action="<?php 
    echo esc_url(get_permalink($post->ID));
    ?>
" method="post" class="refer_a_friend">
<?php 
    $woocommerce->nonce_field('refer_a_friend');
    ?>
<p class="form-row"><label for="swr_refer_emails"><?php 
    _e('Email addresses', 'rewards');
    ?>
</label> <textarea class="input-text" type="text" name="swr_refer_emails" id="swr_refer_emails" placeholder="<?php 
    _e("Enter your friend's email addresses, separated by commas", 'rewards');
Exemplo n.º 5
0
        } else {
            curl_setopt($ch, CURLOPT_URL, $this->apiURL . '&shortUrl=' . $url);
        }
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        // Execute the post
        $result = curl_exec($ch);
        // Close the connection
        curl_close($ch);
        // Return the result
        return json_decode($result, true);
    }
}
require 'pheader.php';
// Create instance with key
$key = $gurl_api;
$googer = new GoogleURLAPI($key);
// Test: Shorten a URL
//加密后的视频流链接
$flvurl1 = $googer->shorten("{$furl}");
//flv
$mp4url1 = $googer->shorten("{$murl}");
//mp4
//获取视频列表
$flvurl = $ym . $ytproxy . '/browse.php?u=' . $flvurl1;
$mp4url = $ym . $ytproxy . '/browse.php?u=' . $mp4url1;
$vname1 = $vname;
$vname1 = substr($vname1, 0, 4);
$API_key = $youtube_api;
$jsonurl = 'https://www.googleapis.com/youtube/v3/search?key=' . $API_key . '&part=snippet&q=' . $vname1 . '&maxResults=20&type=video';
//To try without API key: $video_list = json_decode(file_get_contents(''));
$video_list = json_decode(file_get_contents($jsonurl));
Exemplo n.º 6
0
// this line loads the library 
<?php 
error_reporting(E_ALL);
require "sql.php";
require 'twilio/Services/Twilio.php';
require "shorten.php";
$coreId = $connect->real_escape_string($_REQUEST["coreId"]);
$connect->query("INSERT INTO alerts (coreId) VALUES('{$coreId}');");
$users = $connect->query("SELECT phoneNumber, cu.nickname, c.nickname AS coreNickname FROM coreUsers cu JOIN cores c ON c.coreId = cu.coreId where cu.coreId = '{$coreId}';");
//$account_sid = 'AC8b544d12de2116306aad624241a81c3a';//'AC8b544d12de2116306aad624241a81c3a';
//$auth_token = '7befcdd14703715b5c860699882d144d';//'7befcdd14703715b5c860699882d144d';
$account_sid = 'AC6ab05e44d91b08865d524e3bf2eed82f';
$auth_token = '238ac1fcca9e2e1e55e080f8dbe8c281';
//$account_sid = 'AC6d2c588442b719ffe992d542e40b7ee9';
//$auth_token = '36554a99d691f05c7bdfb5bad83f2b9e';
$client = new Services_Twilio($account_sid, $auth_token);
$mapurl = "";
$googer = new GoogleURLAPI();
$endurl = uniqid();
while ($row = $users->fetch_row()) {
    if ($mapurl == "") {
        $mapurl = $googer->shorten("https://www.google.com/maps/search//@38.855146,-77.0497013,21z/{$endurl}");
    }
    $message = $client->account->messages->create(array('To' => $row[0], 'From' => "+14109275627", 'Body' => trim($row[2]) . " needs assistance. " . $mapurl . " Reply if you can help!"));
    printf("%s (%s)<br/>", $row[0], $row[1]);
}
echo "Sent message {$message->sid}";