<?php
	include_once('../config.php');  
	include_once('../recharges/recharge_api.php');  
    include_once(ABS_PATH.'/custom_function/default.php');       

	 
             
        	if(!isset($_SESSION['userId']))
        	{ 
        		 header("Location: ../");
        		 die;
        	}    
        	
        	
        	
    	    $mobile_no = $_REQUEST['mob'];
            $RechargeAccess_token = "93|7rnAbBltnffBU4653qHtvwcDkB3eqlKyjnJqkET34526ec84";   
            $data_string = '{"service_id":"1","number":"'.$mobile_no.'"}';   
             
                 
            $ch = curl_init('https://api.mobileapi.in/api/v1/plan/operator_info');                                               
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
            'x-tera-tenant-region: IN', 
            'Content-Type: application/json', 
            $headers[] = "Authorization: Bearer ".$RechargeAccess_token,
            'Content-Length: ' . strlen($data_string))                                                                       
            );       																		 
            $response = curl_exec($ch);  
            $Result = json_decode($response); 
             
            
            
    		$stmt= $conn->prepare("select PlanId   from rechargPlanCircle  where PlnaNme=:PlnaNme");  
    		$stmt->bindValue(':PlnaNme', $Result->data->circle_name , PDO::PARAM_STR);  
    		$stmt->execute();
    		$Cname = $stmt->fetch(PDO::FETCH_OBJ);  
    		
    	 
    		
    		$provideId = $Result->data->provider_id;
    		$circle_id = $Cname->PlanId;      
    		
    		$providename = $Result->data->provider_name;      
    		$circle_name = $Result->data->circle_name;      
            
            $data_string = '{"provider_id":"'.$provideId.'","circle_id":"'.$circle_id.'","plantype_id":"2"}';  
             
            $ch = curl_init('https://api.mobileapi.in/api/v2/plan/mobile');                                             
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
            'x-tera-tenant-region: IN', 
            'Content-Type: application/json', 
            $headers[] = "Authorization: Bearer ".$RechargeAccess_token,
            'Content-Length: ' . strlen($data_string))                                                                       
            );       																		 
            $response = curl_exec($ch); 
            //$result = '{"status":0,"data":{"TOPUP":[{"rs":"10","desc":"Talktime of Rs. 7.47","validity":"N\/A","last_update":"11-12-2022"},{"rs":"20","desc":"Talktime of Rs. 14.95","validity":"N\/A","last_update":"11-12-2022"},{"rs":"100","desc":"Talktime of Rs. 81.75","validity":"N\/A","last_update":"11-12-2022"},{"rs":"500","desc":"Talktime of Rs 423.73","validity":"N\/A","last_update":"11-12-2022"},{"rs":"1000","desc":"Talktime of Rs 847.46","validity":"N\/A","last_update":"11-12-2022"},{"rs":"5000","desc":"Talktime of Rs 4237.29","validity":"N\/A","last_update":"11-12-2022"}],"3G\/4G":[{"rs":"19","desc":"Enjoy 1GB data, valid for 1 day","validity":"1 days","last_update":"11-12-2022"},{"rs":"58","desc":"3 GB | Validity same as your existing bundle \/ smart pack","validity":"N\/A","last_update":"11-12-2022"},{"rs":"65","desc":"Enjoy 4GB data valid till your current pack validity.","validity":"N\/A","last_update":"11-12-2022"},{"rs":"98","desc":"Wynk Premium Data Pack\n5 GB Data | 30 days of Wynk Premium subscription","validity":"N\/A","last_update":"11-12-2022"},{"rs":"118","desc":"12 GB | Validity same as your existing bundle \/smart pack","validity":"N\/A","last_update":"11-12-2022"},{"rs":"148","desc":"Xstream Mobile Data Pack 15GB Data |28 days access to any 1 channel (SonyLiv, LionsgatePlay, ErosNow, HoiChoi, ManoramaMAX) on Airtel Xstream App at no extra cost, Validity same as your existing bundle \/smart pack","validity":"N\/A","last_update":"11-12-2022"},{"rs":"181","desc":"Enjoy daily 1GB data, valid for 30 days","validity":"30 days","last_update":"11-12-2022"},{"rs":"301","desc":"50 GB , 1year of Wynk Music Premium subscription, Validity same as your existing bundle \/smart pack","validity":"N\/A","last_update":"11-12-2022"}],"RATE CUTTER":[{"rs":"99","desc":"Enjoy Talk time of Rs99 valid for 28days and 200MB data. Tariff for local and STD calls is Rs2.5p\/sec, Rs1 for local SMS and Rs1.5 for STD SMS. Pack valid for 28 days","validity":"28 days","last_update":"11-12-2022"},{"rs":"109","desc":"Enjoy Talktime of Rs.99 valid for 30 days and 200 MB Data. Tariff voice 2.5p\/sec Local and STD calls. SMS Re1\/Rs1.5 Local\/STD","validity":"30 days","last_update":"11-12-2022"},{"rs":"111","desc":"Enjoy Talktime of Rs.99 valid for 1 month and 200MB Data, Tariff voice 2.5p\/sec Local and STD calls. SMS Re1\/Rs1.5 Local\/STD. Pack validity 1 month","validity":"30 days","last_update":"11-12-2022"},{"rs":"128","desc":"Local & STD calls 2.5p\/sec, National video calls 5p\/sec, DATA 50p\/MB, SMS local Rs.1 STD Rs.1.5 ISD Rs.5, National Roaming Local 80p\/min, STD Rs. 1.15\/min, SMS local 25p STD 38p","validity":"30 days","last_update":"11-12-2022"},{"rs":"131","desc":"Local & STD calls 2.5p\/sec, National video calls 5p\/sec, DATA 50p\/MB, SMS local Rs.1 STD Rs.1.5 ISD Rs.5, National Roaming Local 80p\/min, STD Rs. 1.15\/min, SMS local 25p STD 38p","validity":"30 days","last_update":"11-12-2022"}],"Romaing":[{"rs":"18","desc":"Enjoy ISD calling at discounted rates for 28 days. For country wise tariff visit www.airtel.in","validity":"28 days","last_update":"11-12-2022"},{"rs":"649","desc":"Details: 500 MB Data, 100mins IC+OG (India + Local), 10 SMS (covers-US, Europe, Gulf &. more - Set1) 250 MB Data, 50mins IC+OG (India + Local), 5 SMS (covers-Africa, maldives &. more - Set2) | More covered countries: visit www.airtel.in\/IR","validity":"N\/A","last_update":"11-12-2022"},{"rs":"755","desc":"Details: 1 GB Data (covers-US, Europe, Gulf &. more - Set1) 500 MB Data (covers-Africa, Maldives &. more - Set2) | More covered countries: visit www.airtel.in\/IR","validity":"N\/A","last_update":"11-12-2022"},{"rs":"756","desc":"Details: 100mins IC+OG (India + Local) - (covers-US, Europe, Gulf &. more - Set1) 50mins IC+OG (India + Local) - (covers-Africa, Maldives &. more - Set2) | More covered countries: visit www.airtel.in\/IR","validity":"N\/A","last_update":"11-12-2022"},{"rs":"899","desc":"Details: 1 GB Data, 100mins IC+OG (India + Local), 20 SMS (covers-US, Europe, Gulf &. more - Set1) 500 MB Data, 50mins IC+OG (India + Local), 10 SMS (covers-Africa, Maldives &. more - Set2) | More covered countries: visit www.airtel.in\/IR","validity":"N\/A","last_update":"11-12-2022"},{"rs":"2997","desc":"Details: 2 GB Data, 100mins IC+OG (India + Local), 20 SMS (covers-US, Europe, Gulf &. more - Set1) 1 GB Data, 50mins IC+OG (India + Local), 10 SMS (covers-Africa, Maldives &. more - Set2) | More covered countries: visit www.airtel.in\/IR","validity":"N\/A","last_update":"11-12-2022"},{"rs":"2998","desc":"Details: 5 GB Data, 200mins IC+OG (India + Local), 20 SMS (covers-US, Europe, Gulf &. more - Set1) 2.5 GB Data, 100mins IC+OG (India + Local), 10 SMS (covers-Africa, Maldives &. more - Set2) | More covered countries: visit www.airtel.in\/IR","validity":"N\/A","last_update":"11-12-2022"}],"COMBO":[{"rs":"155","desc":"Enjoy TRULY unlimited Local, STD & Roaming calls on any network, 1 GB data, 300 National SMS for 24 days - Free Hellotunes + Wynk Music Free ","validity":"24 days","last_update":"11-12-2022"},{"rs":"179","desc":"Enjoy TRULY unlimited Local, STD & Roaming calls on any network, 2 GB data, 300 National SMS for 28 days - Free Hellotunes + Wynk Music Free ","validity":"28 days","last_update":"11-12-2022"},{"rs":"199","desc":"Enjoy unlimited Local, STD & Roaming calls on any network, Total 3GB Data & 300 SMS. Valid for 30 days - Free Hellotunes + Wynk Music Free ","validity":"30 days","last_update":"11-12-2022"},{"rs":"209","desc":"Enjoy TRULY unlimited Local, STD & Roaming calls on any network, daily 1GB data and 100 SMS - Free Hellotunes + Wynk Music Free ","validity":"21 days","last_update":"11-12-2022"},{"rs":"239","desc":"Unlimited Local, STD & Roaming 1 GB Data Per Day 24 Days Validity 100 SMS Per Day\t","validity":"24 days","last_update":"01-01-1970"},{"rs":"265","desc":"Enjoy Unlimited Local, STD & Roaming calls Local STD & Roaming calls on any network daily 1GB data and 100 SMS - Free Hellotunes + Wynk Music Free ","validity":"28 days","last_update":"11-12-2022"},{"rs":"296","desc":"Enjoy unlimited Local, STD & Roaming calls on any network, 25GB Data and 100 SMS\/day - Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"30 days","last_update":"11-12-2022"},{"rs":"319","desc":"Enjoy unlimited Local STD & Roaming calls on any network 2GB\/day Data and 100 SMS\/day for 1 Month - Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"30 days","last_update":"11-12-2022"},{"rs":"359","desc":"Enjoy Unlimited Local, STD & Roaming calls Local STD & Roaming calls on any network daily 2GB data and 100 SMS. Pack valid for 28 days. Xstream Mobile Pack 28 days free access to any 1 of the select Xstream channels (SonyLiv, LionsgatePlay, ErosNow, HoiChoi, ManoramaMAX, Chaupal) + Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"28 days","last_update":"11-12-2022"},{"rs":"399","desc":"Enjoy unlimited Local, STD & Roaming calls on any network, 2.5GB\/day data and 100 SMS Pack Valid for 28 days - Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"28 days","last_update":"11-12-2022"},{"rs":"455","desc":"Enjoy TRULY unlimited Local, STD & Roaming calls on any network, 6GB data, 900 National SMS for 84 days - Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"84 days","last_update":"11-12-2022"},{"rs":"479","desc":"Enjoy TRULY unlimited Local, STD & Roaming calls on any network, 1.5 GB data per day, 100 National SMS\/day for 56 days - Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"56 days","last_update":"11-12-2022"},{"rs":"499","desc":"Enjoy unlimited Local, STD & Roaming calls on any network, daily 2GB & 100 SMS Pack Valid for 28 days - Disney+ Hotstar Mobile for 3 Month + Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"28 days","last_update":"11-12-2022"},{"rs":"519","desc":"Enjoy unlimited Local, STD & Roaming calls on any network, daily 1.5GB data and 100 SMS\/day - Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"60 days","last_update":"11-12-2022"},{"rs":"549","desc":"Enjoy unlimited Local, STD & Roaming calls on any network, daily 2GB data and 100 SMS - Xstream Mobile Pack + Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"56 days","last_update":"11-12-2022"},{"rs":"599","desc":"Enjoy TRULY unlimited Local, STD & Roaming calls on any network, 3 GB data per day, 100 National SMS\/day for 28 days and Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"28 days","last_update":"11-12-2022"},{"rs":"666","desc":"Unlimited Local, STD & Roaming Local & STD Calls 1.5 GB Data Per Day 77 Days Validity 100 SMS Per Day","validity":"77 days","last_update":"01-01-1970"},{"rs":"699","desc":"Enjoy Unlimited Local, STD & Roaming calls Local STD & Roaming calls on any network daily 3GB data and 100 SMS - Amazon Prime Membership + Xstream Mobile Pack - Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"56 days","last_update":"11-12-2022"},{"rs":"719","desc":"Enjoy unlimited Local, STD & Roaming calls, 1.5GB\/day data and 100 SMS. Pack valid for 84 days. Cashback of upto Rs80\/month for 3 months with Airtel Mini Rewards123, Click i.airtel.in\/Rwards123 - Xstream Mobile Pack - Apollo 24*7 Circle 3 Months + Get Rs.100 cashback on FASTag + Free Hellotunes + Wynk Music Free + Rewards Mini Subscription ","validity":"84 days","last_update":"11-12-2022"},{"rs":"779","desc":"Enjoy unlimited Local, STD & Roaming calls on any network, daily 1.5GB data and 100 SMS\/day - Apollo 24*7 Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"90 days","last_update":"11-12-2022"},{"rs":"839","desc":"Enjoy unlimited Local, STD & Roaming calls, 2GB\/day data and 100 SMS days. Pack valid for 84 days. Cashback of upto Rs80\/month for 3 months with Airtel Mini Rewards123, Click i.airtel.in\/Rwards123 - Xstream Mobile Pack + Apollo Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free + Rewards Mini Subscription ","validity":"84 days","last_update":"11-12-2022"},{"rs":"999","desc":"Get unlimited Local, STD & Roaming calls, 2.5GB\/day and 100 SMS\/day. Pack valid for 84 days. Cashback of upto Rs80\/month with Airtel Mini Rewards123 is now yours, To know more i.airtel.in\/Rwards123 - Amazon Prime Membership for 84 days + Xstream Mobile Pack + Apollo 24|7 Circle for 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free + Rewards Mini Subscription ","validity":"84 days","last_update":"11-12-2022"},{"rs":"1799","desc":"Enjoy TRULY unlimited Local, STD & Roaming calls on any network, 24GB data, 3600 National SMS for 365 days - Apollo Circle 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"365 days","last_update":"11-12-2022"},{"rs":"2999","desc":"Enjoy unlimited Local, STD & Roaming calls on any network within India, daily 2GB data & 100 SMS, valid for 365 days - Apollo 24|7 Circle + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"365 days","last_update":"11-12-2022"},{"rs":"3359","desc":"Enjoy unlimited Local, STD & Roaming calls on any network, daily 2.5GB & 100 SMS. Pack Valid for 365 days - Disney+ Hotstar Mobile for 1 year + Prime Video Mobile Edition for 1 year + Apollo 24|7 Circle for 3 Months + Get Rs. 100 cashback on FASTag + Free Hellotunes + Wynk Music Free ","validity":"365 days","last_update":"11-12-2022"}]},"message":"Success"}';//curl_exec($ch); 
            
            $ResultArray = json_decode($response); 
            $Ct = 0;    
                      
include_once("../view/dashboard/browsePlan.php");
?>