2020-06-28 06:35:46 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include 'secrets.php';
|
|
|
|
|
2020-07-01 06:42:19 -06:00
|
|
|
$fingerprint = urlencode($_GET["fp"]);
|
|
|
|
$tweetId = urlencode($_GET["id"]);
|
2020-06-28 06:35:46 -06:00
|
|
|
|
|
|
|
$check = "\[Verifying my OpenPGP key: openpgp4fpr:$fingerprint\]";
|
|
|
|
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $twitter_api_auth));
|
|
|
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
curl_setopt($ch, CURLOPT_URL, "https://api.twitter.com/labs/2/tweets/$tweetId?tweet.fields=author_id,created_at,id,source,text");
|
|
|
|
$result = curl_exec($ch);
|
|
|
|
curl_close($ch);
|
|
|
|
$data = json_decode($result, true);
|
|
|
|
|
|
|
|
$response = array();
|
2020-06-28 07:44:23 -06:00
|
|
|
$response["verified"] = false;
|
2020-06-28 06:35:46 -06:00
|
|
|
$response["fingerprint"] = $fingerprint;
|
|
|
|
$response["tweetId"] = $tweetId;
|
|
|
|
$response["text"] = $data["data"]["text"];
|
|
|
|
|
|
|
|
if (preg_match("/{$check}/i", $data["data"]["text"])) {
|
|
|
|
$response["verified"] = true;
|
|
|
|
}
|
|
|
|
echo json_encode($response);
|
|
|
|
|
|
|
|
?>
|