Hi dev.
Recently, Twitter's tweet page no longer shows the origin of tweets such as "Twitter for Android," "Twitter for iOS," and "Twitter Web App," which previously existed.
But if you use Twitter API, you can get it. So I created a mini-tool to make that available to everyone.
â–¼You can try it now :D
https://tools.ic731.net/twitter/for/en
(note) It seems that some environments can see it and some can't.
About API
In this case, I used Twitter API v2 with PHP, which extract tweet ID from URL and throw a GET request to /2/tweets
.
For API operations, I used well-known library abraham/twitteroauth
.
So, please note that setApiVersion("2")
is required to use v2.
$connection = new TwitterOAuth($ck, $cs, null, $brarer);
$connection->setApiVersion("2");
$id = '123456789';
$params = [
"ids" => $id,
"tweet.fields" => "source"
];
// GET
$tweets = $connection->get("tweets", $params);
And "Twitter for xxx", which is the key this time, is stored in $tweets->data[0]->source
. That's all for this simple application. Please try it!
Top comments (1)
123456789