Who will give the detailed code to call the WebService interface in PHP?

Source: Internet
Author: User
Who will give the detailed code to call the WebService interface in PHP? There is a WebService interface, http: // 218.245.0.236: 7880/sms? WSDL
How can I call this interface in PHP? Who gave a detailed code? Thank you!


Reply to discussion (solution)

Are you using the nusoap extension class or the built-in soap class?

This is the usage of the nusoap extension class. you must first go to the next nusoap tool class.

$ SoapClient = new nusoap_client ("http: // 218.245.0.236: 7880/sms? WSDL ", true); $ parameters = array (**, **, **); $ outString = $ soapClient-> call (" webserviceName ", $ parameters ); // generally, many parameters can be configured in the call method. you can configure parameters based on your needs, go to the next packet capture tool and check the package sent and received.

I downloaded nusoap-0.9.5.zip and used nusoap. php in the lip.
My code is written in this way.

Include ('nusoap. php'); // Create a soapclient object. the parameter is server's WSDL $ client = new soapclient ('http: // 218.245.0.236: 7880/sms? WSDL ', 'wsdl'); // Convert the parameter to an array to pass $ aryPara = array ('spid' => '123 ', 'password' => MD5 ('admin41501012 '); // call a Remote Function $ aryResult = $ client-> call ('retrieveall', $ aryPara); echo $ aryResult;

After I run it on a webpage, the returned Array is returned. what does this mean? The returned value is

RESULTCODE ### BALANCE #@#
RDFLAG #### MID ### SPID ### ACCESSCODE ### MOBILE ### STAT #### DELIVERTIME ### RDFLAG ### MID ### SPID #@# ACCESSCODE ### MOBILE ### MSGCONTENT ### DELIVERTIME #@#
This form!
In addition, I can see this on the Internet.
$ Document = $ client-> document;
Echo <


$ Document


SoapDocument;
What does this mean? Thank you for your advice!

If the call is successful, the returned result is the result of the webservice execution.

First, check whether the returned result set is correct.

Set the encoding.

        $soapClient->soap_defencoding = 'utf-8';        $soapClient->decode_utf8 = false;        $soapClient->xml_encoding = 'utf-8';

Add this code before calling
Can solve the garbled problem

The output is Array, and the returned value should be in the form of 1 ### 0!
I add

$document=$client->document;echo <<
 
     
   
       $document   
   
  SoapDocument;?>
 

After that, an Array 3 ###- 1 #### appears. what does this mean? What does this code mean?

I didn't add this string when using it.
It means to construct the package sent in the past. You don't need to write this code.
And I found that the soapclient method you used is a method in the soap class that comes with PHP 5.0 +, not the nusoap extension class you used.
If you want to use the soap class to modify the configuration in php.int, then restart the server.
You write it like this.

Include ('nusoap. php'); // Create a soapclient object. the parameter is server's WSDL $ client = new nusoap_client ('http: // 218.245.0.236: 7880/sms? WSDL ', true); // address the encoding (if needed)/* $ soapClient-> soap_defencoding = 'utf-8'; $ soapClient-> decode_utf8 = false; $ soapClient-> xml_encoding = 'utf-8'; * // Convert the parameter to an array to pass $ aryPara = array ('spid' => '123 ', 'password' => MD5 ('admin41501012 '); // call a Remote Function $ aryResult = $ client-> call ('retrieveall', $ aryPara); echo $ aryResult;

In this way, you do not need to add

How can I add your code to prompt me?

$client = new nusoap_client('http://218.245.0.236:7880/sms?WSDL', true);

What about syntax errors?
What software did you use? I used dreamerweaver. The environment is warm.

Search for your nusoap. what is the specific name of the php file and client method? the soapclient you wrote earlier is a method in the soap class. if it is also called in the nusoap class, a conflict may occur.

By the way, we recommend that you use php ide phpstorm.

Thank you for your help! Now I can use the proxy method to call out the value, but the direct call still does not come out. I had no idea what to do with PHP for the first time. I'm depressed!
Also, this code is required when I use the proxy method to call it.

 
 
  
   $document
  
 SoapDocument;?>

If this code is not directly output, only one Array is displayed, which is depressing. Let me check it out!

Can the landlord provide the specific code? Because I have never learned php, but it must be completed within one week now. it is time-consuming to solve the problem! Please send the package and php code to my mailbox: 1006183252@qq.com thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.