Jnerocorp Posted October 2, 2009 Share Posted October 2, 2009 here is the code I have: <?php header('Cache-Control: no-cache, no-store, must-revalidate'); header('Expires: Sun, 01 Jul 2005 00:00:00 GMT'); header('Pragma: no-cache'); function crop($str, $len) { if ( strlen($str) <= $len ) { return $str; } // find the longest possible match $pos = 0; foreach ( array('. ', '? ', '! ') as $punct ) { $npos = strpos($str, $punct); if ( $npos > $pos && $npos < $len ) { $pos = $npos; } } if ( !$pos ) { // substr $len-3, because the ellipsis adds 3 chars return substr($str, 0, $len) . ''; } else { // $pos+1 to grab punctuation mark return substr($str, 0, $pos+1); } } function shorten_string($string, $wordsreturned) { $retval = $string; $array = explode(" ", $string); if (count($array)<=$wordsreturned) { $retval = $string; } else { array_splice($array, $wordsreturned); $retval = implode(" ", $array)." ..."; } return $retval; } function shorten_string_3c($string) { $retval = ''; $array = explode("_", $string); for ($i = 0; $i < count($array); $i++) { if (strlen($array[$i]) > 0) $retval = $retval . $array[$i] . '_'; } return $retval; } $ch = curl_init("http://search.twitter.com/search?q=RT+%40".$x_twitterid.""); curl_setopt($ch, CURLOPT_HEADER, 0); // curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Googlebot/2.1 (+http://www.google.com/bot.html)'); curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $output = curl_exec($ch); curl_close($ch); //echo $output; $txres = split('<li class="result ">',$output); for($i=1; $i<count($txres); $i=$i+1) { $tmp111 = split('<div class="info">',$txres[$i]); $xstmp = str_replace('<a','<i',$tmp111[0]); $xstmp = str_replace('</a','</i',$xstmp); $xstmp = str_replace('<b>RT</b>','',$xstmp); $xstmp1 = split('</div>',$xstmp); $xstmp2 = $xstmp1[1]; $xstmp2 = str_replace('expand</i>','</i>',$xstmp2); $xstmp2 = str_replace('</i>: <','</i> <',$xstmp2); $xresults = $xresults . $xstmp2 ."</div><br><br>"; } ?> I need: - To kill duplicates on search results, if a text string matches another result it should only display one - Strip username out of the search. - Display timestamps but I am unsure of how to do this Link to comment https://forums.phpfreaks.com/topic/176244-strip-data-from-twitter-feed-help/ Share on other sites More sharing options...
Jnerocorp Posted October 2, 2009 Author Share Posted October 2, 2009 Does anyone know if this is even possible? Link to comment https://forums.phpfreaks.com/topic/176244-strip-data-from-twitter-feed-help/#findComment-928829 Share on other sites More sharing options...
Jnerocorp Posted October 2, 2009 Author Share Posted October 2, 2009 help please? Link to comment https://forums.phpfreaks.com/topic/176244-strip-data-from-twitter-feed-help/#findComment-928966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.