Page 1 of 1
Library or example for use EPO with Guzzle
Posted: Mon Jun 12, 2017 7:28 am
by excellenting
Hi
I'm looking for any documentation about use library
Guzzle and EPO.
I tried some aproach, but fails.
Apreciate help.
Re: Library or example for use EPO with Guzzle
Posted: Mon Jun 12, 2017 1:10 pm
by EPO / OPS Support
Hi,
What exactly didn't work? As much as details you can give the more we are able to help,
Regards,
OPS support
Re: Library or example for use EPO with Guzzle
Posted: Mon Jun 12, 2017 2:44 pm
by excellenting
Hi.
I'm try to connect with guzzle.
Code: Select all
$base_uri = 'https://ops.epo.org/3.2/';
$consumerKey = 'myconsumerkey';
$consumerSecretKey =' mysecretkey';
$client = new Client([
'base_uri' => 'https://ops.epo.org/3.2/'
]);
$request = $client->post('auth/accesstoken', null, array(
'consumerKey' => 'VFfoz7HnXxBffo263mbjaAZijWCdzFgS',
'consumerSecretKey' => 'ymwlMPJzNrlF9KuF',
'grant_type' => 'client_credentials'
));
This get error understanding
Code: Select all
[GuzzleHttp\Exception\ClientException]
Client error: `POST https://ops.epo.org/3.2/auth/accesstoken` resulted in a `401 Unauthorized` response:
<error><code>401</code><message>Client identifier is required</message>
</error>
Re: Library or example for use EPO with Guzzle
Posted: Mon Jun 12, 2017 4:49 pm
by excellenting
Also I tried with curl
Code: Select all
$base_uri = 'https://ops.epo.org/3.2/';
$consumerKey = 'MyConSumerKey';
$consumerSecretKey = 'MySecretKey';
$authorization = base64_encode(($consumerKey.':'.$consumerSecretKey));
$tokens = curl_init();
$url = 'https://ops.epo.org/3.2/auth/accesstoken';
curl_setopt($tokens, CURLOPT_URL, $url);
curl_setopt($tokens, CURLOPT_HTTPHEADER,[
'authorization' => $authorization,
'content-type' => 'application/x-www-form-urlencoded',
'grant_type' => 'client_credentials'
]);
curl_setopt($tokens, CURLOPT_POST,true);
dd(curl_exec($tokens));
Error
Code: Select all
<error><code>401</code><message>Client identifier is required</message>
</error>
Re: Library or example for use EPO with Guzzle
Posted: Tue Jun 13, 2017 6:06 am
by EPO / OPS Support
Hi,
Do you have activated OPS account? This kind of questions would be better addresses if you write to us directly than over a public forum because we need to check you user credentials.
As far as token, in OPS documentation that is liked here several times, you will find how to process your token corectly. Also, in the Announcement section in this forum we have some aditional information related to only v 3.2, so please check that.
Otherwise, maybe some use uses same tool as you and they might be of help with connecting our web service.
Regards,
OPS support
Re: Library or example for use EPO with Guzzle
Posted: Thu Jun 15, 2017 7:09 am
by excellenting
Hi.
After problems with doc of Guzzle, and examples for use with EPO,
I have preferred to build my own class and make connections with cURL. Now everything works for me. Thank you.
Brest regards