Guest
2012-07-11T13:26:05Z
I am trying to use the send with user context method and it does seem to work

I am passing in 3 parameters, the mobile number, the message and the context but get no messages back, no text is sent and no status fields appear to be available.

So my questions are basically does this function actually work and if it does is there a limit on what the context value can be re field types and length?

The function is am trying to use is akin to

function smsmessage($mobile,$smstext,$context)
{
// SendMessageWithUserContext

if ($mobile == "99999999999")
{

$mobile = "99999999999";
$objIntelliSMS = new IntelliSMS();
$objIntelliSMS->Username = 'xxxxxx';
$objIntelliSMS->Password = 'xxxxxxxxxxxxx';
$objIntelliSMS->SendMessageWithUserContext ( $mobile, $smstext, $context );
}
$sendresult_detailed = "";
foreach ( $SendStatusCollection as $SendStatus )
{
$sendresult_detailed = $sendresult_detailed .
$SendStatus["To"] . " " .
$SendStatus["MessageId"] . " " .
$SendStatus["Result"] . "<BR>";
}
echo $sendresult_detailed;
fads_audit_log("Text message",$mobile." - ".$smstext."(".$context.")",$sendresult_detailed,'Y','N');

}


While testing I am only allowing it to send to me personally and for security have replaced my phone number and login details in the above with other values

Support
2012-07-11T15:47:46Z
I notidec that you are not assigned the return from SendMessageWithUserContext to the $SendStatusCollection.

Please try the code below, it should display any error information returned by SendMessageWithUserContext.

function smsmessage($mobile,$smstext,$context)
{
 // SendMessageWithUserContext

 if ($mobile == "99999999999")
 {

  $mobile = "99999999999";
  $objIntelliSMS = new IntelliSMS();
  $objIntelliSMS->Username = 'xxxxxx';
  $objIntelliSMS->Password = 'xxxxxxxxxxxxx';
  $SendStatusCollection = $objIntelliSMS->SendMessageWithUserContext ( $mobile, $smstext, $context );

  $sendresult_detailed = "";
  foreach ( $SendStatusCollection as $SendStatus )
  {
    $sendresult_detailed = $sendresult_detailed .
    $SendStatus["To"] . " " .
    $SendStatus["MessageId"] . " " .
    $SendStatus["Result"] . "<BR>";
  }
  echo $sendresult_detailed;
  fads_audit_log("Text message",$mobile." - ".$smstext."(".$context.")",$sendresult_detailed,'Y','N');
 }

}
Guest
2012-07-11T19:56:27Z
Still no luck

change the last bit to

$SendStatusCollection = $objIntelliSMS->SendMessageWithUserContext ( $mobile, $smstext, $context );
}
echo "<hr>";
echo $SendStatusCollection;
echo "<hr>";
$sendresult_detailed = "";
foreach ( $SendStatusCollection as $SendStatus )
{
$sendresult_detailed = $sendresult_detailed .
$SendStatus["To"] . " " .
$SendStatus["MessageId"] . " " .
$SendStatus["Result"] . "<BR>";
}
echo $sendresult_detailed;
fads_audit_log("Text message",$mobile." - ".$smstext."(".$context.")",$sendresult_detailed,'Y','N');

}

and despite that still get Warning: Invalid argument supplied for foreach() in /home/d/a/dab/public_html/FADS/general_functions.php on line 27

with the echo of the array (or what should be one) being blank (and not as I think it should say "object")

The context value btw is set to xj30q1s563
Guest
2012-07-12T07:38:32Z
doh!

Got a message sent albeit it has now failed to arrive (but that could be related to an O2 issue)

curly bracket was in wrong place and mobile number coming in was wrong so it was skipping the send and trying to look at the results, stupid me.!
Similar Topics
Users browsing this topic