项目作者: aaharu

项目描述 :
SoapClient with ext-curl.
高级语言: PHP
项目地址: git://github.com/aaharu/curlsoapclient.git
创建时间: 2014-09-16T16:31:20Z
项目社区:https://github.com/aaharu/curlsoapclient

开源协议:MIT License

下载


curlsoapclient

Build Status
Scrutinizer Code Quality
Code Coverage
FOSSA Status

A SoapClient wrapper that uses ext-curl.

https://packagist.org/packages/aaharu/curlsoapclient

Documentation

Aaharu\Soap\CurlSoapClient::CurlSoapClient

This class is extended SoapClient.

  1. public CurlSoapClient::CurlSoapClient ( mixed $wsdl [, array $options ] )

supported options

  • soap_version
    • either SOAP_1_1 or SOAP_1_2. If omitted, SOAP_1_1 is used.
  • compression
  • trace
  • exceptions
  • connection_timeout
  • user_agent
  • keep_alive
    • true as a default
  • login
  • password
  • proxy_host
  • proxy_port
  • proxy_login
  • proxy_password
  • authentication
  • ssl_method

additional options

  • redirect_max
    • The maximum amount of HTTP redirections to follow. default is 5.
    • 5 as a default
  • curl_timeout
    • CURLOPT_TIMEOUT
    • 30 as a default
  • proxy_type
    • http, socks4, socks5

unsupported options

  • stream_context
    • not necessary with curl
  • local_cert
    • use CurlSoapClient::___curlSetOpt instead
  • passphrase
    • use CurlSoapClient::___curlSetOpt instead

examples

wsdl mode.

  1. use Aaharu\Soap\CurlSoapClient;
  2. try {
  3. $client = new CurlSoapClient('http://webservices.amazon.com/AWSECommerceService/2013-08-01/AWSECommerceService.wsdl', ['trace' => true]);
  4. $client->ItemLookup();
  5. } catch (\SoapFault $fault) {
  6. }
  7. echo $client->__getLastRequestHeaders() . $client->__getLastRequest();
  1. POST /onca/soap?Service=AWSECommerceService HTTP/1.1
  2. Host: webservices.amazon.com
  3. Accept: */*
  4. Connection: Keep-Alive
  5. Content-Type: text/xml; charset=utf-8
  6. SOAPAction: "http://soap.amazon.com/ItemLookup"
  7. Content-Length: 259
  8. <?xml version="1.0" encoding="UTF-8"?>
  9. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://webservices.amazon.com/AWSECommerceService/2013-08-01"><SOAP-ENV:Body><ns1:ItemLookup></ns1:ItemLookup></SOAP-ENV:Body></SOAP-ENV:Envelope>

non-wsdl mode.

  1. use Aaharu\Soap\CurlSoapClient;
  2. $client = new CurlSoapClient(null, [
  3. 'location' => 'http://example.com/test/location',
  4. 'uri' => 'http://example.com/test/uri',
  5. 'redirect_max' => 1,
  6. 'exceptions' => false,
  7. ]);
  8. $client->doSomething();

Installation

  1. composer require aaharu/curlsoapclient
  2. ## for old PHP
  3. # composer require aaharu/curlsoapclient:1.2.0

Contributing

With composer installed, run the following from the root of the repository:

  1. composer install

Running the tests

  1. ## running built-in server before execute `composer test`
  2. # php -ddisplay_errors=stderr -S localhost:8000 &
  3. composer test

License

Licensed under the MIT License.

FOSSA Status