Hallo Leute
Gebe auf meiner Twitter Seite "bin neu da", die Titel meines Webradios aus.
Und zwar mit diesem PHP-Script per CronJob alle 8 Minuten.
Das Problem, Twitter killt in meinen Twits das Zeichen "&" ohne Gnade, Problem ist dann halt dann das eine Band wzb. Kool & The Gang nicht so dargestellt wird sondern ab Kool alles abgeschnitten wird.
Hat hier eventuell jemand eine Ahnung warum und was in dem obigen Script falsch ist?
Danke.
Gebe auf meiner Twitter Seite "bin neu da", die Titel meines Webradios aus.
Und zwar mit diesem PHP-Script per CronJob alle 8 Minuten.
PHP:
<?php
$username = 'xxxxxxx';
$password = 'xxxxxxx';
$tracks = file_get_contents('http://www.laut.fm/user/disco/jetzt.xml');
$tracks = str_replace('&','&',$tracks);
$tracks = new SimpleXMLElement($tracks);
$song = $tracks->tracks[0]->track[0]->title;
$song = utf8_encode($song);
$artist = $tracks->tracks[0]->track[0]->artist[0]->name;
$artist = utf8_encode($artist);
$album = $tracks->tracks[0]->track[0]->record;
$message = 'Now Playing: '.$artist.' - '.$song. ' http://stream.laut.fm/disco.m3u';
$url = 'http://twitter.com/statuses/update.xml';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
?>
Das Problem, Twitter killt in meinen Twits das Zeichen "&" ohne Gnade, Problem ist dann halt dann das eine Band wzb. Kool & The Gang nicht so dargestellt wird sondern ab Kool alles abgeschnitten wird.
Hat hier eventuell jemand eine Ahnung warum und was in dem obigen Script falsch ist?
Danke.