在php中调用soap函数时出错

时间:2013-11-28 13:06:33

标签: php soap

如何从这个网站获取php中的soap数据 http://www2.rlcarriers.com/freight/shipping-resources/rate-quote-instructions

他们有“GetRateQuote(字符串APIKey,RequestObjects.RateQuoteRequest请求)”  这个函数如何从php soap

中调用它

$ client = new SoapClient('http://api.rlcarriers.com/1.0.1/RateQuoteService.asmx?WSDL'); //的print_r($客户端); // $ result = $ client-> GetRateQuote('xxxxxxxxxxxxxxxxxxxxxx .......',);

的print_r($结果); ?> 我应该在第二个参数

中传递什么

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

$client = new SoapClient("http://api.rlcarriers.com/1.0.1/ShipmentTracingService.asmx?WSDL", array("trace" => 1));

$request = array(
    "APIKey" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "request" => array(
        "TraceNumbers" => array(
            0 => "xxxxxxxxx"
        ),
        "TraceType" => "PRO",
        "FormatResults" => "true",
        "IncludeBlind" => "true",
        "OutputFormat" => "Standard"
    )
);

try {
    $response = $client->TraceShipment($request);
    print_r($response);
}
catch (SoapFault $exception) {
    print_r($exception);
}