Twitter API GET users/search (PHP ile 20’den Fazla Kullanıcı Arama Listeleme)

Twitter developer sayfasında yer alan get-users-search bilgilerine göre tek sayfada 20 sonuç döndürmek mümkün, twitter api ile daha fazla sonucu nasıl gösterebiliriz diye düşünenlere fikir vermek amacıyla sonuçlar döngüsünün en dışına yerleştirilecek bir döngü ile tek seferde 20’den fazla sonucu ekrana yansıtmak mümkün, 15 dakikada 900 sorgu limitini aşmamak şartı ile aşağıdaki örneğe göre php kullanarak users/search kullanımını ve daha fazla sonnuç listeleme yapabilirsiniz.

require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
define('CONSUMER_KEY', 'WwwwfdfdhdhdffdfDDd');    // add your app consumer key between single quotes
define('CONSUMER_SECRET', 'RtteefFFGgGGGggggggghHHHHhhh'); // add your app consumer secret key between single quotes
define('OAUTH_CALLBACK', 'callback.php'); // your app callback URL i.e. 
 
 
 
    $access_token = $_SESSION['access_token'];
    $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
    $user = $connection->get("account/verify_credentials", ['include_email' => 'true']);
 
 for ($o = 1; $o < 4;$o++) {
 
 $baglanti = $connection->get("users/search",['q'=>"test",'page'=>"$o"]);
 
 
for ($i = 0; $i < 20;$i++) {
 
echo $baglanti[$i]->screen_name."<br>";
 
	}
 
}

Kaynak: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-search

HTML special characters php (PHP ile HTML karakterleri temizleme)

PHP’nin htmlspecialchars fonksiyonu sayesinde html karakterleri temizleyerek GET ve POST işlemlerinden gelen verileri temizleyebilirsiniz.

Örnek Kullanımı:

<?php
$metin= "Örnek <b>metin</b> text.";
echo htmlspecialchars($metin);
?>

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given HATA ÇÖZÜMÜ

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\xxx\xxx.php on line 10

Böyle bir hata alıyorsanız muhtemelen sql sorgunuzda yer alan bir parametre tablonuzda yok demektir. Lütfen tablo adı, sütun adı gibi bilgileri gözden geçirmeyi deneyin.