Aug
30

Twitter advanced search with ptwix

2009

From version 1.1 ptwix can show results of a twitter search.
Make search is really simple:

Setting the value PtwiX::$SEARCH at the “timeline type” parameter in the constructor.

$PtwiX=new PtwiX('firs',PtwiX::$SEARCH,'silver-red');

Now you can call the setSearchString method and pass it the string that you want to search.

//show 30 tweets that contains the "php" tag
$PtwiX->setSearchString("php&rpp=30");

You can setting a title for your search with this code line
UPDATE: This call is deprecated from the 2.0rc1 version.

$PtwiX->setSearchTitle("All about php");

This is a complete example

<? include "core/PtwiX.php";
$PtwiX=new PtwiX('firs',PtwiX::$SEARCH,'silver-red');
?>
<html>
<head>
<? $PtwiX->printCssRef(); ?>
</head>
<body>
<?
$PtwiX->setSearchString("q=ptwix");
$PtwiX->printBox();
?>
</body>
</html>

For more information on searching queries and operators read the twitter documentation

Tags: , , ,

Leave a Reply