I would like to grab all the hashtags using PHP from http://search.twitter.com/search.atom?q=%23eu-jele%C4%A1%C4%A1i
The hashtags are in the content, title nodes within the RSS feed. They are prefixed with #
The problem I am having is with non-English letters (outside of the range a-zA-Z).
If you look at the RSS feed and then view the html source my struggle might be clearer.
<title>And more: #eu-jeleġġi #eu-kiest #ue-wybiera #eu-eleger #ue-alege #eu-vyvolenej #eu-izvoli #eu-elegir #eu-välja #eu-elect</title>
Do I need to do some something with the title node before I find my rexexp matches.
My ultimate aim is to replace the hashtag with the twitter search url e.g. http://search.twitter.com/search.atom?q=%23eu-jele%C4%A1%C4%A1i
Here is some sample code to help you along.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body>
<?php
$title="And more: #eu-jeleġġi #eu-kiest #ue-wybiera #eu-eleger #ue-alege #eu-vyvolenej #eu-izvoli #eu-elegir #eu-välja #eu-elect";
// this is the regexp that hashtags.org use (http://twitter.pbwiki.com/Hashtags)
$r = preg_replace("/(?:(?:^#|[\s\(\[]#(?!\d\s))(\w+(?:[_\-\.\+\/]\w+)*)+)/"," <a href=\"http://search.twitter.com/search?q=%23\1\">\1</a> ", $title);
echo "<p>$r</p>";
$r = preg_replace("/(#.+?)(?:(\s|$))/"," <a href=\"http://search.twitter.com/search?q=\1\">\1</a> ", $title);
echo "<p>$r</p>";
// This is my desired end result
echo "<p><a href=\"http://search.twitter.com/search?q=%23eu-jeleġġi\">#eu-jeleġġi</a></p>";
?>
</body>
</html>
Any advice or solution would be greatly appreciated.