PHP Classes

PHP Mobile Recharge API: Recharge mobile phone account balance

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 58%Total: 645 All time: 4,960 This week: 63Up
Version License PHP version Categories
recharge-api 2.0Free for non-comm...4.0PHP 5, Wireless and Mobile, Web services
Description 

Author

This package can recharge mobile phone account balance.

It can send HTTP requests to a mobile phone provider API to recharge the account balance.

The mobile phone account and phone provider are configured using a separate class.

Innovation Award
PHP Programming Innovation award nominee
February 2015
Number 2


Prize: PhpStorm IDE personal permanent license
Several mobile phone carriers provide APIs that can take requests to recharge the account of a mobile device.

This class can send requests to recharge phone account balance of different mobile device carriers configured externally.

Manuel Lemos
Picture of Ruturaj Maniyar
  Performance   Level  
Name: Ruturaj Maniyar <contact>
Classes: 2 packages by
Country: India India
Innovation award
Innovation award
Nominee: 2x

Example

<?php
   
require_once 'operation.php';
    require_once
'ServiceProvider.php';

if(isset(
$_POST['Submit'])){
   
   
$operationType = $_POST['operationType'];
        unset(
$_POST['operationType']);
        unset(
$_POST['Submit']);
  
   
$PostData = $_POST;
   
$obj = new ServicesPro();
   
$response = $obj->OperationServices($operationType, $PostData);
    echo
$response;
   
$decodeResponse = json_decode($response);
    echo
'<br/>';
    echo
'<br/>';
    echo
"##################################################################################################################";
    echo
'<br/>';
    
    echo
'<pre>';
   
print_r ((array)$decodeResponse);
    echo
'</pre>';
    
} else {
       
$html = '<form method="POST" name="CLXForm" id="CLXForm" action="#">
                                <table bgcolor="#C4C4C4" align ="center" style="table-layout: inherit; height: 80%; width: 40%; font-family: "comic Sans MS", cursive; font-weight: 900; font-size: 14px; line-height: 5px;" bordercolorlight ="#336666" >
                                    <tbody>
                                        <tr style="background-color: #63C9F7; table-layout: fixed;font-weight: 900; font-size: 24px; height: 90px" bordercolor="#33CC66">
                                            <td align="center">
                                                <h3>
                                                    Demo for
                                                    <b> CLX Web Services</b>
                                                </h3>
                                            </td>
                                        </tr>
           
            <tr>
                <td style="vertical-align: text-top">
                    <table align="center" style="height: 70%; width: 80%; vertical-align: text-top">
                        <tbody>
                            <tr>
                                <td align="left"> Operation Type </td>
                                <td align="left"> : </td>
                                <td align="left">
                                                <select id="operationType" name="operationType" style="width: 150px;" onchange="this.form.submit();">
                                                                             <option value=""> Select </option>'
;

                                                                                                       
$obj = new Provider_Form();
                                                                                                        foreach (
$obj->Methods as $key => $value) {
                                                                                                            if (isset(
$_POST['operationType'])) {
                                                                                                                if (
$_POST['operationType'] == $key) {
                                                                                                                   
$selected = 'selected';
                                                                                                                } else {
                                                                                                                   
$selected = '';
                                                                                                                }
                                                                                                            }
                                                           
$html .= '<option value = "' . $key . '" ' . @$selected . '>' . $key . '</option>';
                                                }
                           
$html .= '</td>
        </tr>'
;
                           
                                            if (isset(
$_POST['operationType']) && $_POST['operationType'] != '') {
                                               
$html .= '<tr>
                                                                <td colspan="3" align="center"> <br />
                                                                    <fieldset>
                                                                            <legend>Request Parmeters</legend>
                                                                                    <table>'
;
                                                                                                                       
$attr = ($_POST['operationType'] != '') ? $obj->Operations[$_POST['operationType']] : "";
                                                                                                                        foreach (
$attr as $key => $value) {
                                                                                                                           
$html .= '<tr>
                                                                                                                            <td>'
. $key . '</td>
                                                                                                                            <td><input type="text" name="'
. $key . '" value="' . $value . '"/></td>
                                                                                                                    </tr>'
;
                                                                                                                        }
                                                                                   
$html .= '</table>
                                                                                                </fieldset>
                                                                                        </td>
                                            </tr>

                                            <tr>
                                                    <td colspan="3" align="center">
                                                            <input type="submit" name="Submit" value="Submit" />
                                                    </td>
                                            </tr>'
;
                                            }

$html .= '</table>
            </td>
        </tr>
    </table>
</form>'
;
echo
$html;
}
?>


  Files folder image Files (4)  
File Role Description
Files folder imagedata (3 files, 1 directory)

  Files folder image Files (4)  /  data  
File Role Description
Files folder imageservices (1 directory)
  Accessible without login Plain text file index.php Example for understand, Modify this code as per requirements
  Plain text file operation.php Class define the all the operations.
  Plain text file ServiceProvider.php Class define the class navigation with function name

  Files folder image Files (4)  /  data  /  services  
File Role Description
Files folder imagerechargeMobile (1 file)

  Files folder image Files (4)  /  data  /  services  /  rechargeMobile  
File Role Description
  Accessible without login Plain text file rechargeMobile.php Example Recharge Class file. This recharge library file that send the request to provider server.

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:645
This week:0
All time:4,960
This week:63Up
User Ratings User Comments (3)
 All time
Utility:83%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:-
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:58%StarStarStar
Rank:1406