私は何年もインターネットを検索してきましたが、この問題の解決策を見つけることができませんでした。
$follow = $_GET['follow'];
$following = $_GET['following'];
session_start();
if(!empty($_SESSION['username'])){
$twitteroauth = new TwitterOAuth('MY PRIVATE CODE', 'MY PRIVATE CODE', $_SESSION['oauth_token'], $_SESSION['oauth_secret']);
}
$follow_timeline = $twitteroauth->get('followers/ids', array('screen_name' => $follow));
$following_timeline = $twitteroauth->get('friends/ids', array('screen_name' => $following));
if (in_array($following, $follow_timeline)) {
echo "We found the word!";
}
jsonファイルからのデータです。これも読めます。https://dev.twitter.com/docs/api/1/get/friends/ids & https://dev.twitter.com/docs/api/1/get/followers/ids . 上記のスクリプトを実行すると、このエラーが表示されます。
in_array() [function.in-array]: Wrong datatype for second argument in
そして、前にjsonデコードを使用することを考えましたif (in_array($following, $follow_timeline))
が、このエラーが表示されます。
json_decode() expects parameter 1 to be string, object given in
誰か助けてください。私はPHPを始めたばかりで、少し混乱していました。