Beispiel #1
0
 //print $sql; die;
 $rec = mysql_query($sql);
 if (mysql_num_rows($rec) > 0) {
     print "Doing {$dataset}:\n";
     while ($res = mysql_fetch_assoc($rec)) {
         $kloutid = $kloutScore = $kloutDayChanges = $kloutWeekChanges = $kloutMonthChanges = $http_code = 0;
         $kloutTopics = array();
         $from_user_id = $res['from_user_id'];
         $from_user_name = $res['from_user_name'];
         $kloutid = $res['kloutid'];
         // klout score
         $klout = new KloutAPIv2($kloutapi_key);
         // http://klout.com/s/developers/v2
         $network = "twitter";
         if (empty($kloutid)) {
             $kloutid = $klout->KloutIDLookupByID("tw", $from_user_id);
         }
         /*
          * var_export($klout);
          * print "\n";
          * var_export($kloutid);
          * print "\n"; 
          */
         $http_code = $klout->info['http_code'];
         print strftime("%Y-%m-%d %H:%M:%S", date('U')) . " - " . $from_user_name . " - " . var_export($kloutid, 1) . " - " . $http_code . "\n";
         if ($http_code != 200) {
             if ($http_code == 403 || $http_code == 503 || $http_code == 504) {
                 $errors++;
             }
             if ($errors > 2) {
                 die("died because of " . $http_code . "\n");
Beispiel #2
0
                                        Network: <select name="NetworkPlatform"><option value="tw">Twitter</option></select><br />
                                        User: <input type="text" name="NetworkUserID" value="13044" /><br />
                                        <input type="submit" value="Get Klout ID" />
                                    </form>
                                </div>
                                <div class="clear"></div>

                            <?php 
// Is there a Screen name or ID to use?
if (isset($screenname)) {
    //echo "<p>Klout ID for <strong>$screenname</strong> on <strong>$network</strong> is: ";
    $kloutid = $klout->KloutIDLookupByName($network, $screenname);
    //echo "<strong>". $kloutid ."</strong>";
} elseif (isset($userid)) {
    //echo "<p>Klout ID for <strong>$userid</strong> on <strong>$network</strong> is: ";
    $kloutid = $klout->KloutIDLookupByID($network, $userid);
    //echo "<strong>". $kloutid ."</strong>";
}
// Is there a Klout ID to be found?
if (isset($kloutid)) {
    echo "<h2>Klout ID: " . $kloutid . "</h2>\n";
    $KloutScore = ceil($klout->KloutScore($kloutid));
    ?>
                                    <hr />

									<div id="score">
										<div class="large-flag kscore">
											<img class="kflag" src="http://kcdn3.klout.com/static/images/stroke-flag.png">
											<span class="value"><?php 
    echo $KloutScore;
    ?>