Skip to content

Instantly share code, notes, and snippets.

@NuckChorris
Created April 26, 2011 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NuckChorris/941658 to your computer and use it in GitHub Desktop.
Save NuckChorris/941658 to your computer and use it in GitHub Desktop.
Birthday Handling
<?
function get_birthdays() {
$socket = fsockopen( "birthdays.24bps.com", 80 );
if ($socket === false) {
return false;
}
try {
$headers = "";
$headers .= "GET /feed/today HTTP/1.1\r\n";
$headers .= "Host: birthdays.24bps.com\r\n";
$headers .= "User-Agent: {$this->dAmn->Agent}\r\n";
$headers .= "Connection: close\r\n";
$headers .= "\r\n";
$response = "";
fputs($socket, $headers);
while ( !@feof( $socket ) ) {
$response .= @fgets( $socket );
}
$parts = explode("\r\n\r\n", $response);
$this->dAmn->say( $this->settings['room'], "<bcode>" . $parts[1] . "</bcode>" );
$xml = simplexml_load_string($parts[1]);
print_r($xml);
} catch ( Exception $e ) {
$this->dAmn->say( $this->settings['room'], $e );
return false;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment