How to post SOAP Request from PHP

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

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

7条回答
  •  死守一世寂寞
    2020-12-01 03:59

    Below is a quick example of how to do this (which best explained the matter to me) that I essentially found at this website. That website link also explains WSDL, which is important for working with SOAP services.

    However, I don't think the API address they were using in the example below still works, so just switch in one of your own choosing.

    $wsdl = 'http://terraservice.net/TerraService.asmx?WSDL';
    
    $trace = true;
    $exceptions = false;
    
    $xml_array['placeName'] = 'Pomona';
    $xml_array['MaxItems'] = 3;
    $xml_array['imagePresence'] = true;
    
    $client = new SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions));
    $response = $client->GetPlaceList($xml_array);
    
    var_dump($response);
    

提交回复
热议问题