Converting retweet script into API v1.1


The documentation for API v1.1 is very messy and very hard to understand, it really hasn’t been a smooth switch over. Whilst I have sorted out my timeline script on my site, I am having problems with my retweet script. I never had any errors before but it has stopped working since yesterdays 1.0 shut down.

Warning: Invalid argument supplied for foreach() on line 16 is my error now but this only happened since 1.0 shut down. My apps are set up properly and everything else so what is the new code I need in order for this to work with the API 1.1? (app set on GET)

<?php require_once('twitteroauth.php'); define('CONSUMER_KEY', '\\'); define('CONSUMER_SECRET', '\\'); define('ACCESS_TOKEN', '\\'); define('ACCESS_TOKEN_SECRET', '\\'); $twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET); $twitter->host = ""; $search = $twitter->get('search',array('q' => 'from:eurogamer OR from:destructoid OR from:outsidexbox OR from:xbox OR from:OXMUK OR from:playstationEU OR from:gamespotuk OR from:nintendouk OR from:GamesRadar OR from:Joystiq OR from:gamespot OR from:xboxuk OR from:dtoid OR from:onm_uk OR from:PC_Gamer OR from:oxm OR from:kotaku OR from:InsideGaming', 'rpp' => 4)); $twitter->host = ""; foreach($search->results as $tweet) { $status = 'RT @'.$tweet->from_user.' '.$tweet->text; if(strlen($status) > 140) $status = substr($status, 0, 139); $twitter->post('statuses/update', array('status' => $status)); } echo "Success! Check your twitter bot for retweets!"; ?>