I am new in nusop , I have a code which works good in php simple file ( I mean not in laravel ) , but when I want to use it in laravel ,does not work at all !
this is my code :
<?php
require_once "./lib/nusoap.php";
//Parameters
//
$param = array(
'user_id' => 'MY_USERNAME',
'password' => 'MY_PASSWORD',
'lic_username' => '.......',
'lic_password' => '.......',
'debug' =>1);
//Create object that referer a web services
$client = new nusoap_client('https://store.esetme.com/remote/v2/webshop.php?wsdl' ,true);
//Call a function at server and send parameters too
$response = $client->call("GetLicenseVerification", $param);
//Process result
//
if ($client->fault) {
echo "FAULT: <p>Code: (" . $client->faultcode . "</p>";
echo "String: " . $client->faultstring;
} else {
if ($response['error'] == '') {
//Request is Successful
//Handle Response Data
echo $response['licensekey'];
echo '<br />';
echo $response['username'];
echo '<br />';
echo $response['password'];
echo '<br />';
echo $response['expiration_date'];
}
else {
//An error occurred
//Handle Error
echo $response['error'];
}
}
?>
and the output is : test-licensekey test-username test-password 09/29/2015
But I want to use it in Laravel 5.1 .
so I created Libraries
directory in app
Folder , and put nusoap.php
there and renamed it to nusoap_client.php
and I have put namespace App\Libraries;
in top of it .
and I use this in my controller , but out put is null !
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Libraries\nusoap_client;
class NusoapController extends Controller
{
public function getIndex()
{
$param = array(
'user_id' => 'MY_USERNAME',
'password' => 'MY_PASSWORD',
'lic_username' => '.......',
'lic_password' => '.......',
'debug' =>1);
//Create object that referer a web services
$client = new nusoap_client('https://store.esetme.com/remote/v2/webshop.php?wsdl' ,true);
//Call a function at server and send parameters too
$response = $client->call("GetLicenseVerification", $param);
//Process result
//
if ($client->fault) {
echo "FAULT: <p>Code: (" . $client->faultcode . "</p>";
echo "String: " . $client->faultstring;
} else {
if ($response['error'] == '') {
//Request is Successful
//Handle Response Data
echo $response['licensekey'];
echo '<br />';
echo $response['username'];
echo '<br />';
echo $response['password'];
echo '<br />';
echo $response['expiration_date'];
}
else {
//An error occurred
//Handle Error
echo $response['error'];
}
}
}
}
I found the solution , I changed my idea for using nusoap library ! I decided to use pure soap :
this is my controller which works good :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use SoapClient;
class NusoapController extends Controller
{
public function getIndex()
{
$client = new SoapClient('https://store.esetme.com/remote/v2/webshop.php?wsdl');
$results = $client->GetLicenseVerification( 'MY_USERNAME' , 'MY_PASSS' , '......' , '......' , 1 );
print_r($results);
}
}