Friday, June 28, 2019

Setting up pure callback url for telenor server

Step 01 - Create ubuntu droplet with lampstack
Step 02 - Create a new virtual host file with with your domain
Step 03 - Setup letsencrypt SSL
Step 04 - Create a new folder for your domain name in /var/www/ folder and create a new php file name to redirect to
Step 05 - install curl by typing sudo apt-get install php-curl
Step 06 - Restart apache sudo service apache2 restart
Step 07 - Now Copy paste the following redirection code in your php file

<html>
 <head>

  <title>Subscription callback</title>
 </head>
 <body>
<?php
$newurl = "https://api.yourdomain.com/callback_notification?";
                $parameters = "";
                $count =sizeof($_GET);
                $index = 0;
                foreach($_GET as $key => $value)
                {
                        $parameters = $parameters. $key . "=" . $value;
                        if($index < $count - 1)
                                $parameters = $parameters . "&";

                        $index++;
                }

                $newurl = $newurl . $parameters;

                $ch = curl_init();
                curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
                curl_setopt($ch, CURLOPT_HEADER, 0);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
                curl_setopt($ch, CURLOPT_URL, $newurl);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

                $data = curl_exec($ch);
                curl_close($ch);
                echo $data;
        ?>
 </body>
</html>

No comments:

Post a Comment