Created
April 26, 2011 01:49
-
-
Save NuckChorris/941658 to your computer and use it in GitHub Desktop.
Birthday Handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
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