steg 1.
ändra #### FYLL I #### - detta är fält som innehåller dina cookies, så logga in till FB, gör en sökning och skriv sedan ner dina cookie värden här.
steg 2.
lägg upp php filen på din webbserver
observera att den fungerar endast var 15:e sec
ändra #### FYLL I #### - detta är fält som innehåller dina cookies, så logga in till FB, gör en sökning och skriv sedan ner dina cookie värden här.
steg 2.
lägg upp php filen på din webbserver
observera att den fungerar endast var 15:e sec
Kod:
<?php
class RSSFeed {
// VARIABLES
// channel vars
var $channel_url;
var $channel_title;
var $channel_description;
var $channel_lang;
var $channel_copyright;
var $channel_date;
var $channel_creator;
var $channel_subject;
// image
var $image_url;
// items
var $items = array();
var $nritems;
// FUNCTIONS
// constructor
function RSSFeed() {
$this->nritems=0;
$this->channel_url='';
$this->channel_title='';
$this->channel_description='';
$this->channel_lang='';
$this->channel_copyright='';
$this->channel_date='';
$this->channel_creator='';
$this->channel_subject='';
$this->image_url='';
}
// set channel vars
function SetChannel($url, $title, $description, $lang, $copyright, $creator, $subject) {
$this->channel_url=$url;
$this->channel_title=$title;
$this->channel_description=$description;
$this->channel_lang=$lang;
$this->channel_copyright=$copyright;
$this->channel_date=date("Y-m-d").'T'.date("H:i:s").'+01:00';
$this->channel_creator=$creator;
$this->channel_subject=$subject;
}
// set image
function SetImage($url) {
$this->image_url=$url;
}
// set item
function SetItem($url, $title, $description) {
$this->items[$this->nritems]['url']=$url;
$this->items[$this->nritems]['title']=$title;
$this->items[$this->nritems]['description']=$description;
$this->nritems++;
}
// output feed
function Output() {
$output = '<?xml version="1.0" encoding="iso-8859-1" ?>'."\n";
$output .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">'."\n";
$output .= '<channel rdf:about="'.$this->channel_url.'">'."\n";
$output .= '<title>'.$this->channel_title.'</title>'."\n";
$output .= '<link>'.$this->channel_url.'</link>'."\n";
$output .= '<description>'.$this->channel_description.'</description>'."\n";
$output .= '<dc:language>'.$this->channel_lang.'</dc:language>'."\n";
$output .= '<dc:rights>'.$this->channel_copyright.'</dc:rights>'."\n";
$output .= '<dc:date>'.$this->channel_date.'</dc:date>'."\n";
$output .= '<dc:creator>'.$this->channel_creator.'</dc:creator>'."\n";
$output .= '<dc:subject>'.$this->channel_subject.'</dc:subject>'."\n";
$output .= '<items>'."\n";
$output .= '<rdf:Seq>';
for($k=0; $k<$this->nritems; $k++) {
$output .= '<rdf:li rdf:resource="'.$this->items[$k]['url'].'"/>'."\n";
};
$output .= '</rdf:Seq>'."\n";
$output .= '</items>'."\n";
$output .= '<image rdf:resource="'.$this->image_url.'"/>'."\n";
$output .= '</channel>'."\n";
for($k=0; $k<$this->nritems; $k++) {
$output .= '<item rdf:about="'.$this->items[$k]['url'].'">'."\n";
$output .= '<title>'.$this->items[$k]['title'].'</title>'."\n";
$output .= '<link>'.$this->items[$k]['url'].'</link>'."\n";
$output .= '<description>'.$this->items[$k]['description'].'</description>'."\n";
$output .= '<feedburner:origLink>'.$this->items[$k]['url'].'</feedburner:origLink>'."\n";
$output .= '</item>'."\n";
};
$output .= '</rdf:RDF>'."\n";
return $output;
}
};
header('Content-type: application/rdf+xml');
require_once "HTTP/Request.php";
$req =& new HTTP_Request("http://www.flashback.info/search.php?do=getnew");
// $req->addPostData("Connection", "keep-alive");
// $req->addPostData("Keep-Alive", "300");
// $req->addPostData("Accept-Charset", "ISO-8859-1,utf-8;q0.7,*;q0.7");
// $req->addPostData("Accept-Encoding", "gzip,deflate");
// $req->addPostData("Accept-Language", "sv,en-us;q0.7,en;q0.3");
// $req->addPostData("Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q0.9,text/plain;q0.8,image/png,*/*;q0.5");
// $req->addPostData("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5");
// $req->addPostData("Host", "www.flashback.info");
$req->sendRequest();
foreach ($req->getResponseHeader() as $name => $value) {
//echo $name . " = " . $value . "\n";
if(strcmp($name,"location")==0) {
$req =& new HTTP_Request($value);
}
}
$req->addCookie("vbscanlastvisit", "#### FYLL I ####");
$req->addCookie("vbscanuserid", "#### FYLL I ####");
$req->addCookie("vbscanlastactivity", "#### FYLL I ####");
$req->addCookie("vbscanpassword", "#### FYLL I ####");
$req->addCookie("vbscansessionhash", "#### FYLL I ####");
$myfeed = new RSSFeed();
$myfeed->SetChannel('www.rss.com/rss.rss',
'FB',
'senaste',
'en-us',
'(c)me',
'me',
'my subject');
if (!PEAR::isError($req->sendRequest())) {
//echo $req->getResponseBody();
$svar=$req->getResponseBody();
//echo $svar;
$start=0;
$begin=0;
for ( $counter = 0; $counter < 20; $counter += 1) {
$start=strpos($svar,'id="thread_title_',$begin);
$begin=$start+1;
$thread_id=substr($svar,$start+17,6);
$topic=substr($svar,$start+25,strpos($svar,"</a>",$start+26)-($start+25));
//echo "<a href=http://flashback.info/showthread.php?t=$thread_id>$topic</a>";
//echo "<br>\n";
$link="http://flashback.info/showthread.php?t=$thread_id";
$myfeed->SetItem($link,
$topic,
$topic);
}
echo $myfeed->output();
//$rss =$myfeed->output();
// $filename = "test.rss";
// $handle = fopen($filename, "wb");
// $numbytes = fwrite($rss, $newstring);
// fclose($handle);
// print "$numbytes bytes written\n";
}
?>