ManCuniAn
Мастер
- Регистрация
- 5 Фев 2009
- Сообщения
- 269
- Реакции
- 32
- Автор темы
- #1
Код:
<?php
$usernames = "xxxxx";
$limit = "5";
$prefix = "";
$prefix_sub = "";
$wedge = "";
$suffix_sub = "<br>";
$suffix = "";
function parse_feed($usernames, $limit, $prefix_sub, $wedge, $suffix_sub) {
$usernames = str_replace(" ", "+OR+from%3A", $usernames);
$feed = "http://search.twitter.com/search.atom?q=from%3A" . $usernames . "&rpp=" . $limit;
$feed = file_get_contents($feed);
$feed = str_replace("&", "&", $feed);
$feed = str_replace("<", "<", $feed);
$feed = str_replace(">", ">", $feed);
$clean = explode("<entry>", $feed);
$amount = count($clean) - 1;
for ($i = 1; $i <= $amount; $i++) {
$entry_close = explode("</entry>", $clean[$i]);
$clean_content_1 = explode("<content type=\"html\">", $entry_close[0]);
$clean_content = explode("</content>", $clean_content_1[1]);
echo $prefix_sub;
$file = "1.txt";
$fh = fopen($file, "a+");
echo $clean_content[0];
fputs($fh,$clean_content[0]."\r\n");
echo $suffix_sub;
fclose($fh);
}
}
echo $prefix;
parse_feed($usernames, $limit, $prefix_sub, $wedge, $suffix_sub);
echo $suffix;
?>