在 Laravel 4 中发送 XML SOAP 请求
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18833505/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Send XML SOAP request in Laravel 4
提问by arielcr
Does Laravel 4 have a library to send XML SOAP Requests, or is there a proper way to do this in Laravel instead of doing it manually with CURL?
Laravel 4 是否有一个库来发送 XML SOAP 请求,或者是否有正确的方法在 Laravel 中执行此操作而不是使用 CURL 手动执行此操作?
回答by George Brighton
I'm not familiar with Laravel, but PHP itself has a very nice class called SoapClient
which you can use to send SOAP requests in a couple of lines. There's definitely no need to do it with cURL.
我不熟悉 Laravel,但 PHP 本身有一个非常好的类SoapClient
,您可以使用它来在几行中发送 SOAP 请求。绝对没有必要用 cURL 来做。
回答by fideloper
Laravel does not contain any XML/SOAP libraries out of the box.
Laravel 不包含任何开箱即用的 XML/SOAP 库。
However, since Laravel is composer-friendly, you can use any SOAP Composer package.
但是,由于 Laravel 对Composer友好,您可以使用任何SOAP Composer 包。
回答by Akshay Khale
You can use built in PHP SoapClientClass in Laravel
您可以在 Laravel 中使用内置的 PHP SoapClient类
by simply adding SoapClient class in app/config.phpaliases Array
只需在app/config.php别名数组中添加 SoapClient 类
'SoapClient' => SoapClient::class
And whenever you want to use SoapClient Class just add
use SoapClient;
in the file.
每当您想使用 SoapClient 类时,只需use SoapClient;
在文件中添加即可
。