Take the User_timeline interface as an example
Let's talk about my ideas.
First, you have to understand the nature of the microblogging interface call.
In fact, the SDK you downloaded is just another one, but its core is to simulate a browser to send a post or GET request for JSON data.
$res = Http::request ($url, $params, ' get ');//Access API
This phrase is to use the Get method to invoke the API's
Date specified as 2013/7/20
convert it to int
Intval (Strtotime ("2013/7/20"));
Take out the created_at of each tweet and convert it to int at a specified date than
Specifically implemented as follows
public static function Getweibobydate ($access _token, $screen _name, $startDate) {
$url = "Https://api.weibo.com/2/statuses/user_timeline.json";
$page = 1;
$count = 100;
$continue =true;
$j = 0;
$i = 0;
while ($continue) {
$params =array (
"Access_token" => $access _token,
"Screen_name" => $screen _name,
"Page" => $page,
"Count" => $count
);
$res = Http::request ($url, $params, ' get ');//Access API
$result = Json_decode ($res, true);
foreach ($result [' statuses '] as $key => $value) {
$time [$i]= strtotime ($value [' created_at ']);
if (Intval (Strtotime ($value [' created_at '])) > $startDate) {
$WL [$i] [' ID ']= $value [' id '];
$WL [$i] [' Source ']= $value [' Source '];
$WL [$i] [' Text ']= $value [' text '];
if (Isset ($value [' retweeted_status '])) {
$WL [$i] [' type '] = "forward";
}
else{
$WL [$i] [' type '] = "original";
}
$WL [$i] [' reposts_count '] = $value [' Reposts_count '];
$WL [$i] [' comments_count '] = $value [' Comments_count '];
$WL [$i] [' created_at '] = $value [' Created_at '];
$WL [$i] [' bmiddle_pic '] = $value [' Bmiddle_pic '];
Preg_match_all ("% # (. *?) #%si ", $value [' text '], $match);
$WL [$i] [' title '] = $match [1][0];
$i + +;
}
}
$endDate = Intval (Strtotime ($result [' statuses '] [$count -1][' created_at ']);
if ($endDate > $startDate) {
$continue =true;
}
else{
$continue = false;
}
$page + +;
}
return $WL;
}