Example #1
0
 /**
  * Store a newly created topup in storage.
  *
  * @return Response
  */
 public function store()
 {
     $soapClient = new SoapClient("http://116.90.227.165/wsnlivebkp/Service/Service.asmx?WSDL");
     // Prepare SoapHeader parameters
     $sh_param = array('User_id' => 'MQSUPPORT', 'Password' => 'MQSUPPORT', 'ExternalPartyName' => 'MQS');
     $headers = new SoapHeader('http://tempuri.org/', 'MQUserNameToken', $sh_param, false);
     // Prepare Soap Client
     $soapClient->__setSoapHeaders(array($headers));
     //request XML
     $requestXML = '<REQUESTINFO>
                            <KEY_NAMEVALUE>
                                 <KEY_NAME>CUSTOMERNO</KEY_NAME>
                                 <KEY_VALUE>' . $_POST["customer_id"] . '</KEY_VALUE>
                            </KEY_NAMEVALUE>
                       </REQUESTINFO>';
     $referenceNo = time();
     //reference number should be unique
     $result = $soapClient->GetCustomerInfo(array('CustomerInfoXML' => $requestXML, 'ReferenceNo' => $referenceNo));
     $xml_data = $result->GetCustomerInfoResult;
     $xml = simplexml_load_string($xml_data);
     $json = json_encode($xml);
     $data_array = json_decode($json);
     // echo '<pre>';
     // print_r($data_array);
     // echo '<pre>';
     if ($data_array->STATUS->ERRORNO == 0) {
         Session::put('user', $_POST["customer_id"]);
         return View::make('topups.index', compact('data_array'));
     }
 }