Be careful, $HTTP_RAW_POST_DATA isn't available unless PHP 5 has been configured to register it. Usually you want to read from the php://input stream which isn't dependent on the local configuration.
Paddy Pádraic Brady http://blog.astrumfutura.com http://www.survivethedeepend.com OpenID Europe Foundation Irish Representative ________________________________ From: Nicholas Granado <[email protected]> To: [email protected] Sent: Thu, February 18, 2010 9:58:27 AM Subject: Re: [pubsubhubbub] Re: callback url PHP Jesper.... if($_GET) { $mode = $_GET['hub.mode']; $topic = $_GET['hub.topic']; $challenge = $_GET['hub.challenge']; echo $challenge; } else if($$HTTP_RAW_POST_DATA) { $atom = simplexml_load_string($HTTP_RAW_POST_DATA); $time = $atom->entry->updated; $title = $atom->entry->title; $content = $atom->entry->summary; $source = $atom->entry->link['href']; $entry_data = sprintf("%s\n%s\n%s\n%s\n--\n", strtotime($time[0]), $title[0], $content[0], $source[0]); $_title = $title[0]; $_source = $source[0]; $_content = $content[0]; // probably want to do something to the data here. } Cheers, Nick--- Nicholas Granado twitter: heatxsink web: http://nickgranado.com email: [email protected] On Mon, Feb 15, 2010 at 9:56 AM, Josh Fraser <[email protected]> wrote: >if ($_GET['hub_challenge']) { >> // you should verify the subscription before returning the >>challenge, but this will get you started. >> echo $_GET['hub_challenge']; >>} else if ($_SERVER['REQUEST_METHOD'] === 'POST') { > >> $fp = fopen("php://input", 'r+'); > >> $server = $_SERVER["QUERY_STRING"]; >> $xml_string = stream_get_contents($fp); > >> $xml = simplexml_load_string($xml_string); > >} > > >>On Feb 15, 9:59 am, Jesper <[email protected]> wrote: >>> I am wondering if someone has some example code for the callack url >>> content distribution in php. >
