Problem performing API requests

Asked

Viewed 108 times

0

I’m trying to place requests to an API: EGOI but get an error.

The request is as follows::

http://api.e-goi.com/v2/rest.php?method=checklogin&apikey=minhaAPIKEY

You know how I pass parameters to ZEND?

I get the following error:

<?xml version="1.0" encoding="UTF-8"?>
<Egoi_Api generator="zend" version="1.0">
    <checklogin>
        <ERROR>NO_USERNAME_AND_PASSWORD_AND_APIKEY</ERROR>
        <status>success</status>
    </checklogin>
</Egoi_Api>

1 answer

0

You must have the login data (username, password or token), make a request for the api url with the data by your controller

use Zend\Http\Client;

$client = new Client();
$client->setUri('http://api.fooo.com');
$client->setMethod('POST');
$client->setParameterPost(array(
   'username' => 'bar',
   'password' => 'bar',
));

$response = $client->send();

if ($response->isSuccess()) {
   // successo
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.