i am working on twitter API https://api.twitter.com/1.1/users/search.json when i request for a user records using GET request i am getting just first page of records in json first 20 records but i want all records of any specific name which i enter how to extend the request and store them in database
public function getTwitter() {
$settings = array(
'oauth_access_token' => "xxxxxxxxxxxxxx",
'oauth_access_token_secret' => "xxxxxxxxxxxxxxxx",
'consumer_key' => "xxxxxxxxxxxxxxxxxxxxx",
'consumer_secret' => "xxxxxxxxxxxxxxxxxxxxxxx"
);
$url = 'https://api.twitter.com/1.1/users/search.json';
$getfield = '?q=name to search';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$users = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$users = json_decode($users,true);
// var_dump($users);die();
for($i=0;$i<=19;$i++)
{
$twitter=new twitter_user();
$twitter->user_id=$users[$i]['id'];
$twitter->name=$users[$i]['name'];
$twitter->sname=$users[$i]['screen_name'];
$twitter->location=$users[$i]['location'];
$twitter->save();
}
echo "Data saved";
i am using this for loop till 19 because its giving me 20 records i want to access all available records dynamically
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire