- Registriert
- 21.11.04
- Beiträge
- 1.754
Hi Ihr!
Ich hab ein nettes kleines PHP File geschrieben, das den letzten Twitter Eintrag in den Buschfunk bei Schüler und Studi VZ schreibt.
Orginalpost: @Twitter
Viel Spaß Damit.
Ich hab ein nettes kleines PHP File geschrieben, das den letzten Twitter Eintrag in den Buschfunk bei Schüler und Studi VZ schreibt.
Code:
<?
//Edit this with your information...
//StudiVZ
$loginStudi = "xxx";
$pwStudi = "xxx";
//SchuelerVZ
$loginSch = "xxx";
$pwSch = "xxx";
//Twitter Account Name
$loginTwitter = "xxx";
//DO NOT EDIT ANYTHING DOWN HERE!
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$loginTwitter.json");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$buffer = curl_exec($ch);
$json = json_decode($buffer);
$text = $json[0]->text;
if (substr($text,0,strlen('@')) != '@'){
if(!file_exists("timestamp.txt")){
$fp = fopen("timestamp.txt", "w");
fclose($fp);
}
$handle = fopen("timestamp.txt","r");
$n = fgets($handle,1000);
fclose($handle);
if(md5($text) != $n){
$url = "http://m.studivz.net/op/studivz/de/mcat/login/";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)");
$buffer = curl_exec($ch);
$needle = "/op/studivz/de/mcat/login/;jsessionid=";
$session = substr($buffer,strpos($buffer,$needle)+strlen($needle),32); // REGEX = nerdy
$url = "http://m.studivz.net/op/studivz/de/mcat/login/;jsessionid=".$session;
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=$loginStudi&password=$pwStudi");
$buffer = curl_exec($ch);
$url = "http://m.studivz.net/op/studivz/de/mcat/status/senden/;jsessionid=".$session;
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, "text=$text");
$buffer = curl_exec($ch);
$url = "http://m.schuelervz.net/op/schuelervz/de/mcat/login/";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)");
$buffer = curl_exec($ch);
$needle = "/op/schuelervz/de/mcat/login/;jsessionid=";
$session = substr($buffer,strpos($buffer,$needle)+strlen($needle),32); // REGEX = nerdy
$url = "http://m.schuelervz.net/op/schuelervz/de/mcat/login/;jsessionid=".$session;
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "username=$loginSch&password=$pwSch");
$buffer = curl_exec($ch);
$url = "http://m.schuelervz.net/op/schuelervz/de/mcat/status/senden/;jsessionid=".$session;
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, "text=$text");
$buffer = curl_exec($ch);
$fp=fopen("timestamp.txt","w");
fputs($fp, md5($text));
fclose($fp);
}
}
?>
Orginalpost: @Twitter
Viel Spaß Damit.