john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

php backtype

<?php
$backtype_user_key = 'a5cf415bc97c7adcf7cb' ;


function get_backtype_user_requests( $backtype_user_key )
{
    $query = 'http://api.backtype.com/rate_limit_status.json?pretty=1&key=' . $backtype_user_key ;
    $backtype_limit_result = file_get_contents( $query );
    #/* debugging */ print_r( $backtype_limit_result );     print PHP_EOL . "<br /><br />" . PHP_EOL;

    $status_check = json_decode( $backtype_limit_result , true) ;  #assoc array from json data
    #/* debugging */ print_r( $ar['status'] );              print PHP_EOL . "<br /><br />" . PHP_EOL;

    $array = $status_check[ 'status' ];
    return $array[ 'user-requests' ];

} #end check_backtype_user_requests


function get_backtype_comments ( $backtype_user_key , $keywords )
{
    $query = 'http://api.backtype.com/comments/search.json?q=backtype&key=' . $backtype_user_key ;
    $comments = file_get_contents( $query );
    #/* debugging */ print_r( $comments );     print PHP_EOL . "<br /><br />" . PHP_EOL;

    $comment_stream = json_decode( $comments , true) ;  #assoc array from json data
    #/* debugging */ print_r( $ar );              print PHP_EOL . "<br /><br />" . PHP_EOL;

    $items_per_page = $comment_stream[ 'itemsperpage' ];
    /* debugging */ print( $items_per_page );       print PHP_EOL . "<br /><br />" . PHP_EOL;

    $array = $comment_stream[ 'comments' ];
    /* debugging */ print_r( $array );              print PHP_EOL . "<br /><br />" . PHP_EOL;



    for( $i = 0; $i< 25; $i++ )
    {
        $comment_struct = $array[ $i ];


        print $comment_struct[ 'date' ] . "<br />";


        print_r( $comment_struct );
        print PHP_EOL . "<br /><br />" . PHP_EOL;


    }


    #return $array['user-requests'];

} #end



print "<html><head></head><body>";


$backtype_user_requests = get_backtype_user_requests( $backtype_user_key );

print $backtype_user_requests . "backtype user requests";
print PHP_EOL . "<br /><br />" . PHP_EOL . "<hr>";


get_backtype_comments ( $backtype_user_key , "twitter" );
print PHP_EOL . "<br /><br />" . PHP_EOL . "<hr>";


print "</body></html>";
?>

  • « eclipse ide c wascana cpp 32bit
  • strings »

Published

Nov 8, 2010

Category

php

~161 words

Tags

  • backtype 1
  • php 82