Hi Guys, I'm setting up an SMS interface using this class (http://www.phpclasses.org/browse/file/5564.html) and would like to be able to get a client message id into the class. In here $comm = sprintf ("%s/sendmsg?session_id=%s&to=%s&from=%s&text=%s&callback=%s%s", Code (markup): I need to be able to add &climsgid=xxx where xxx is the unique message id. To use the class I simply have to use $results = $mysms->send($_POST['to'],$_POST['from'],$_POST['message']); Code (markup): and I want to be able to add the message id in here. I hope this makes sense to someone. Any help will be greatly appreciated.
Just a suggestion, use TM4B. They're cheaper, and I have a working class for this. http://www.bytemycode.com/snippets/snippet/647/
I looked at them and they looked more expensive. 3.5p (AUD$0.08) for SMS in Australia where clickatell is only 6c at the lower volume rate, and cheaper for volume purchase. Thanks for the suggestion though
I edited line 156 to add the extra parameter: function send($to=null, $from=null, $text=null, $climsgid=null) { PHP: Lines 188-196 now look like this: $comm = sprintf ("%s/sendmsg?session_id=%s&to=%s&from=%s&text=%s&climsgid=%s&callback=%s%s", $this->base, $this->session, rawurlencode($to), rawurlencode($from), rawurlencode($text), rawurlencode($climsgid), $this->callback, $concat PHP: and to call it, you should now do: $results = $mysms->send($_POST['to'],$_POST['from'],$_POST['message'], $climsgid); PHP: As far as I can tell, that should be the only edits necessary to support the extra variable you want. Let me know how it works.
omgitsfletch you are a legend. Thanks so much for your help. I knew it would be fairly straight forward but I'm still trying to get my head around OO programming and classes. Thanks heaps.
Heh, well luckily in this case, it was a lot more work just modifying the class function than actually changing the class. If you go to php.net/sprintf, you'll find out a bit more on what that command is doing. Those %s represent variables, and the whole purpose of sprintf() is having variables out of the actual string to make it easier to understand. So it was just a matter of adding a variable, and putting it in the appropriate order underneath the sprintf(). If you have any other problems, feel free to PM me. I'm here to help.