You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.
To be able to distinguish different implementaions of this library from one another, it should be possible to set a $userAgent parameter that is used in a User-Agent header which is sent every HTTP request against PayEx' API.
It should be possible to set custom HTTP headers in the stream_context key of the options array parameter of the SoapClient constructor:
// We should of course figure out which version this library as well as PHP we're running dynamically and not hard coded liket his:$userAgent = $this->_userAgent . 'PayEx.Ecommerce.Php/1.0.2 php/7.0.6';
// The stream_context needs to include the 'ssl' key if 'ssl_verify' is set to true.$context = stream_context_create(array('http' => array('header' => "User-Agent: $userAgent"));
$options = array('stream_context' => $context);
$client = new \SoapClient($wsdl, $options);
Since the stream_context is already initialized in __construct(), the header key can just be added there along with the already existing ssl key being set if ssl_verify is true.
The format of the User-Agent header should be as per RFC 7231 section 5.5.3. We should include as much information in the header as possible, such as the version of PHP and any library relevant to the HTTP request. Simply put, it should look something like this:
To be able to distinguish different implementaions of this library from one another, it should be possible to set a
$userAgent
parameter that is used in aUser-Agent
header which is sent every HTTP request against PayEx' API.It should be possible to set custom HTTP headers in the
stream_context
key of theoptions
array parameter of theSoapClient
constructor:Since the
stream_context
is already initialized in__construct()
, theheader
key can just be added there along with the already existingssl
key being set ifssl_verify
istrue
.The format of the
User-Agent
header should be as per RFC 7231 section 5.5.3. We should include as much information in the header as possible, such as the version of PHP and any library relevant to the HTTP request. Simply put, it should look something like this:User-Agent: PayEx.Magento/1.2.3 PayEx.Ecommerce.Php/1.0.2 Magento/1.9.2.4 PHP/7.0.6
The text was updated successfully, but these errors were encountered: