Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Feb 2010
    Posts
    208
    Thanks
    15
    Thanked 2 Times in 2 Posts

    Fortumo.com script

    Hi,

    I want to install Fortumo.com system in my site.

    => Fortumo.com <=

    But I dont know how to use those HTTP GET request... So, can someone explain the script bellow and say what I have to change if I want it working?

    PHP Code:
    <?php

      
    //set true if you want to use script for billing reports
      //first you need to enable them in your account
      
    $billing_reports_enabled false;

      
    // check that the request comes from Fortumo server
      
    if(!in_array($_SERVER['REMOTE_ADDR'],
          array(
    '81.20.151.38''81.20.148.122''209.20.83.207'))) {
        die(
    "Error: Unknown IP");
      }

      
    // check the signature
      
    $secret ''// insert your secret between ''
      
    if(!empty($secret) && !check_signature($_GET$secret)) {
        die(
    "Error: Invalid signature");
      }

      
    $sender $_GET['sender'];
      
    $message $_GET['message'];

      
    // do something with $sender and $message
      
    $reply "Thank you $sender for sending $message";

      
    // print out the reply
      
    echo($reply);
     
     
    //customize this according to your needs
      
    if($billing_reports_enabled 
        
    && preg_match("/Failed/i"$_GET['status']) 
        && 
    preg_match("/MT/i"$_GET['billing_type'])) {
       
    // find message by $_GET['message_id'] and suspend it
      
    }


      function 
    check_signature($params_array$secret) {
        
    ksort($params_array);

        
    $str '';
        foreach (
    $params_array as $k=>$v) {
          if(
    $k != 'sig') {
            
    $str .= "$k=$v";
          }
        }
        
    $str .= $secret;
        
    $signature md5($str);

        return (
    $params_array['sig'] == $signature);
      }
    ?>
    What I want to do is: 1. I write SMS with "HEY secret-code" 2. They will get this message and send me response 3. I will get the response as a PHP variable.

    if you need more info - ask...


    Thanks...
    Last edited by auriaks; 06-17-2010 at 04:15 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •