tweeting pipes
juust | 30/06/2009…but serious, channels on Twitter are a hot item.
Twitter seem to want branded channels for commerce by using verified accounts to prevent spoofing celebrities, and the same goes for brandnames. There is already a growing trade in twitter accounts like @nike-shoes, @skyeurope.
To build an attractive channel I need credibility, provide regular good quality fresh content, so where do I get that :
Yahoo pipes
I am very lazy and Yahoo have a nice example online, the news aggregator with 14 sources like blogsearch, icerocket, technorati, that you can clone and use out of the box. So I cloned it, replaced the technorati api key and run the pipe with ‘banking’ as keyword. I grab the rss feed url and read that with simplexml (you can use that pipe with any keyword).
Then I take a twitter php api class from sourceforge (it only reads the account, it doesnt have the post-routines), by simon wippich, wire in the rss-feed and start posting content.
-
require_once('twitter.class.php');
-
$Twitter = Twitter::getInstance();
-
$Twitter->setUser('Account','SomePassword');
-
-
$rss= simplexml_load_file("http://pipes.yahoo.com/pipes/pipe.run?_id=1234567890&_render=rss&textinput1=banking");
-
-
if($rss)
-
{
-
foreach($rss->channel->item as $e)
-
{
-
$shrunk = file_get_contents('http://bit.ly/api?url='.$e->link);
-
$msg = trim(substr($e->title, 0, (137-strlen($shrunk)))).' '.$shrunk;
-
$output = $Twitter->post($msg);
-
}
-
}

Now I can post proper stuff.
The second part of a channel is the audience.
Where to get my audience ?
Google Search
Google serp scrapers are always good for 1000 targetted results on any keyword : i use
allinanchor:twitter.com/ site:twitter.com banking
as search phrase, that gets me 95% valid accounts with my keyword banking in the description
-
$key = 'banking';
-
//scrape urls
-
$urls = twt_Google('allinanchor:twitter.com/ site:twitter.com '.$key);
-
//get the account names
-
$accounts = twt_Google_getaccounts($urls);
-
-
function twt_Google($keywords, $pages=1) {
-
//scrape results off of google serp
-
$lang='en';
-
$results=100;
-
for($i=0;$i< $pages;$i++){
-
$start = $i*100+1;
-
$vargoogleresultpage = "http://www.google.com/search?as_q=".urlencode(trim($keywords))."&num=".$results."&start=".$start."&hl=en&lr=lang_en";
-
$googleresponse = join("",file($vargoogleresultpage));
-
$googlehits = preg_split('/class=r><a /', $googleresponse, -1, PREG_SPLIT_OFFSET_CAPTURE);
-
$i=0;
-
foreach($googlehits as $googlehit){
-
$i++;
-
preg_match("/href=\"(.*?)\"/", $googlehit[0], $t, PREG_OFFSET_CAPTURE);
-
$the_urls[] = $t[1][0];
-
}
-
}
-
-
//return a set with twitter urls http://www.twitter.com/account
-
return $the_urls;
-
}
-
-
function twt_Google_getaccounts($arr) {
-
//get the account name from the twitter-url
-
for($i=0;$i<count($arr);$i++){
-
$parts = explode('/', $arr[$i]);
-
//account is 3 : http: // … / account
-
$myaccounts[] = $parts[3];
-
}
-
return $myaccounts;
-
}
There is my audience, lets make some friends :
-
-
for($i=0;$i<count ($accounts);$i++){
-
followthisone($accounts[$i], 'Account','SomePassword');
-
}
-
-
function followthisone($accountname, $name, $pass) {
-
$url = "http://twitter.com/friendships/create/".$accountname.".xml";
-
$ch = curl_init();
-
curl_setopt($ch, CURLOPT_URL,$url);
-
curl_setopt($ch, CURLOPT_POST, 1);
-
curl_setopt($ch, CURLOPT_USERPWD, $name.":".$pass);
-
$result= curl_exec ($ch);
-
curl_close ($ch);
-
}
hello friends!
Anyways, that’s the basic ingredients of a marketing channel, proper content and an audience.








