PHP calls the WSDL file type interface code share, _php tutorial

Source: Internet
Author: User
Tags array definition

PHP calls the interface code share of the WSDL file type,


Copy CodeThe code is as follows:
<?php
This class is automatically generated by the system and is intended for testing purposes only
Class Indexaction extends Action {
Public Function index () {
#分销商订单提交, modify, Cancel, query interface
$wsdl 1= ' http://127.0.0.1:8080/ejfxs/services/order?wsdl ';
#分销商可销售产品接口地址
$wsdl = ' http://127.0.0.1:8080/ejfxs/services/availableProducts?wsdl ';
Instantiating an Object
$client =new soapclient ($WSDL);
Interface parameters.
$param 1=array (' password ' = ' 123456 ', ' dis_code ' = ' fxbzzhlyw ', ' checkcode ' = ' fxfaxm5u1y ');
interface method.
$ret 1 = $client->getavailableproducts ($param 1);
Convert XML data to an array
$array = (array) $ret 1;
Convert to Simplexml_load_string Object
$v =simplexml_load_string ($array [' return ']);
Array definition
$Varr = $v->ybproducts->fzhproducts->product;
Get to a specific value
for ($i =0; $i < count ($Varr); $i + +) {
echo $Varr [$i]->prod_id;
echo $Varr [$i]->product_name;
echo $Varr [$i]->prod_code;
echo $Varr [$i]->prod_category;
echo $Varr [$i]->supply_id;
echo $Varr [$i]->price;
echo $Varr [$i]->parprice;
echo $Varr [$i]->total_ticket_num;
echo $Varr [$i]->inventory;
echo $Varr [$i]->product_name;
echo $Varr [$i]->product_name;
Echo '
';
}
Get interface all methods and parameters
Print_r ($client->__getfunctions ());
Print_r ($client->__gettypes ());
}
}
?>

=================================================================

That's probably the way it is! The above comments are quite clear. Do not understand the message. or suggestions for improvement. Message.

http://www.bkjia.com/PHPjc/914059.html www.bkjia.com true http://www.bkjia.com/PHPjc/914059.html techarticle PHP calls the WSDL file type interface code share, copy the code as follows: PHP//This class is automatically generated by the system, for testing purposes class Indexaction extends Action {public funct ...

  • Related Article

    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.