Why I can't get tweet to be display? #51
Unanswered
sayfrndship1234
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I followed everything, can anyone help to display tweets, here is my code.
require "vendor/autoload.php";
use Noweh\TwitterApi\Client;
$settings = [
'account_id' => '25892507',
'consumer_key' => 'eRrNUEWcoE.....XXXX',
'consumer_secret' => 'A1hAzq01...XXXX',
'bearer_token' => 'AAAAAA...XXXX',
'access_token' => '1391460...XXXX
'access_token_secret' => 'kgufgJN...XXXX
];
$client = new Client($settings);
$ch = curl_init();
//--------------------------------
// GET user id by user NAME:
//--------------------------------
$turl='https://api.twitter.com/2/users/by/username/awofficial786'; // i m not sure which one to use to get tweet feed of user
$turl='https://api.twitter.com/2/tweets/search/recent'; // i m not sure which one to use to get tweet feed of user
curl_setopt($ch, CURLOPT_URL, $turl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = array();
$headers[] = 'Authorization: Bearer A-----XXXXX';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
'; exit;if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
$resp=json_decode($result );
echo '
Beta Was this translation helpful? Give feedback.
All reactions