How to post SOAP Request from PHP

后端 未结 7 790
野趣味
野趣味 2020-12-01 03:39

Anyone know how can I post a SOAP Request from PHP?

7条回答
  •  情话喂你
    2020-12-01 04:09

    You might want to look here and here.

    A Little code example from the first link:

    '0385503954');
    // define path to server application
    $serverpath ='http://services.xmethods.net:80/soap/servlet/rpcrouter';
    //define method namespace
    $namespace="urn:xmethods-BNPriceCheck";
    // create client object
    $client = new soapclient($serverpath);
    // make the call
    $price = $client->call('getPrice',$param,$namespace);
    // if a fault occurred, output error info
    if (isset($fault)) {
            print "Error: ". $fault;
            }
    else if ($price == -1) {
            print "The book is not in the database.";
    } else {
            // otherwise output the result
            print "The price of book number ". $param[isbn] ." is $". $price;
            }
    // kill object
    unset($client);
    ?>
    

提交回复
热议问题