API MessageReceived Handler

Help with the Esendex API

API MessageReceived Handler

Postby probinett » Sun Dec 04, 2011 4:16 pm

Hello,

I am trying out Esendex, and just created the following Push Notification SMS handler:
Name Type Url
BF Handler MessageReceived http://www.bubblefoundry.com/esendex/


I placed a very similar PHP script there to test things and make sure the connection was working:

Code: Select all
<?php
$filename = "request.txt";
$fh = fopen($filename, "w");
fwrite($fh, print_r($_REQUEST, true));
fclose($fh);
print "request saved";
?>


All I do is write the GET and POST parameters to a log file. However, every time I send an SMS to the virtual number attached to my account the log file, while updated (as shown by its timestamp), only has an empty array of parameters.

Why is this? Thanks.
probinett
 
Posts: 1
Joined: Sun Dec 04, 2011 4:14 pm

Re: API MessageReceived Handler

Postby iain1 » Mon Jan 16, 2012 12:49 pm

I too am experiencing this problem.

Any ideas?
iain1
 
Posts: 2
Joined: Mon Jan 16, 2012 12:48 pm

Re: API MessageReceived Handler

Postby iain1 » Tue Jan 17, 2012 10:27 am

Solution:

Code: Select all

  public function executeEsendexcallback()
  {
    $string = file_get_contents('php://input');
       
    $xml = simplexml_load_string("<?xml version='1.0'?>" . $string);

    $messageText = $xml->MessageText;
    $from = $xml->from;
    // and likewise for other xml elements (Id, MessageId, AccountId, MessageText, From, To)
  }

iain1
 
Posts: 2
Joined: Mon Jan 16, 2012 12:48 pm


Return to API



cron
© Esendex Ltd 2010
Company Registration Number: 04217280