Jump to content

Send Soap by PHP composer fail load class


nitiphone2021

Recommended Posts

Dear All.
Now I am trying to send Soap to server by PHP code
I install composer and require soapclient but on my PHP code is fail

This is my command for composer
composer require phpro/soap-client
This is PHP code file name
testSendSMS.php

require_once 'vendor/autoload.php';
$operator = "http://ltcservice..com:5577/Services.asmx?WSDL";
$privateKey = "BDX89Cxfpp";
$headerSMS = "TEST"; // TEST
$userid = "BDX";
$txtTel ="2059545445659";
$newRegCode_exp = rand();
$messageBody = "Test SMS";
//$serverIP = $_SERVER['REMOTE_ADDR'];
$serverIP = "172.28.17.61";
$trans_id = "BDX".rand();
//$trans_id = "123456";
$data = $serverIP.$trans_id;
$messageBody = $serverIP.$trans_id;
echo '<br/>'.$data. " >=> " . exec("java -jar encrypt.jar ".$data." ".$privateKey, $key);
echo '<br/>'.$key[1]. " >=> " . exec("java -jar decrypt.jar ".$key[1]." ".$privateKey, $output);
echo '<br/> encrypt result >=> '.$key[0];
if($key[0]=="OK"){
$header = array('userid' => $userid,
'trans_id' => $trans_id,
'key' => $key[1],
);
echo '<br/>';
print_r($header);
$client = new SoapClient($operator);
$msg = array(
'msisdn' => $txtTel,
'message' => $messageBody,
'headerSMS' => $headerSMS,
'header' => $header,
);
$requestmsg = array('msg'=>$msg);
echo '<br/>';
print_r($msg);
$data = $client->SendSMS($requestmsg);
echo '<br/>';
print_r($data);
}
Error Fatal error: Uncaught Error: Class 'SoapClient' not found in C:\xampp\htdocs\sms\SEND_SMS\testSendSMS.php:27 Stack trace: #0 {main} thrown in C:\xampp\htdocs\sms\SEND_SMS\testSendSMS.php on line 27

 

Capture.PNG

Capture2.PNG

Link to comment
Share on other sites

You need to install SoapClient separately. It is not normally installed by default. You don't specify what OS you are using but in Linux you need to do either:

sudo apt-get install php-soap

or

sudo yum install php-soap

depending on your flavor of *NIX.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.