Selamun Aleyküm dostlar, Anlayan varsa bakabilir mi nerede hata yapıyorum?
function tweetidCheck($id, $admin)
{
if (is_numeric($id)) {
$yasakli = 0;
$data = file("../token.txt");
shuffle($data);
$data = array_reverse($data);
$token = $data[0];
$token = json_decode($token);
$opt = array("api_url" => "https://api.twitter.com/1.1/statuses/show.json", "consumer_key" => "3nVuSoBZnx6U4vzUxf5w", "consumer_secret" => "Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys", "access_token" => $token->access_token, "access_token_secret" => $token->access_token_secret, "method" => "GET", "post" => array("id" => $id), "header" => true);
$que = curl_api($opt);
if ($que->http_code != 0) {
$decode = json_decode($que->content);
$hataSorgu = isset($decode->errors) ? $decode->errors : 0;
$hata_Sorgu = isset($decode->error) ? $decode->error : 0;
if ($hataSorgu != 0 || $hata_Sorgu != 0) {
$json = array("error" => true, "mesaj" => "Bilinmeyen bir hata oluştu. Hesabınızın korumalı olup olmadığını kontrol ettikten sonra tekrar deneyin.");
} else {
$decod = json_decode($que->content);
if ($admin != 1 && sansurKelime) {
$bolBakalim = explode(",", sansurKelime);
foreach ($bolBakalim as $kelime) {
if (preg_match("#" . $kelime . "\\b#", $decod->text)) {
$json = array("error" => true, "mesaj" => "Attığınız tweette " . $kelime . " kelimesi bulunduğu için beğeni işleminiz iptal edildi.");
$yasakli++;
}
}
}
if ($yasakli == 0) {
if ($admin != 1) {
if (urlKontrol == 1 && 0 < count($decode->entities->urls)) {
$yasakli++;
} else {
if (hashtagKontrol == 1 && 0 < count($decode->entities->hashtags)) {
$yasakli++;
} else {
if (mentionKontrol == 1 && 0 < count($decode->entities->user_mentions)) {
$yasakli++;
}
}
}
}
if ($yasakli == 0) {
$json = array("error" => false, "data" => $decod->user->screen_name);
} else {
$json = array("error" => true, "mesaj" => "Attığınız tweette <strong>URL,Hashtags,Mention</strong> bulunduğu için beğeni işleminiz iptal edildi.");
}
}
}
} else {
$json = array("error" => true, "mesaj" => "Twitter ile bağlantı kurulurken bir sorun oluştu. Lütfen daha sonra tekrar deneyin.");
}
} else {
$json = array("error" => true, "mesaj" => "Girdiğiniz link hatalı.Girdiğiniz linki kontrol ettikten sonra tekrar deneyin.");
}
return json_encode($json);
}