PHP Classes

File: data/index.php

Recommend this page to a friend!
  Classes of Ruturaj Maniyar   PHP Mobile Recharge API   data/index.php   Download  
File: data/index.php
Role: Example script
Content type: text/plain
Description: for understand, Modify this code as per requirements
Class: PHP Mobile Recharge API
Recharge mobile phone account balance
Author: By
Last change:
Date: 9 years ago
Size: 6,434 bytes
 

Contents

Class file image Download
<?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;
}
?>