API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Connect example for the REST api and PHP

0
Hi, does anyone have a small example on how to onnect to the REST api from PHP using the Token method?
created Feb 2, 2016 by donslund
50% Accept Rate
Q 2 A 1 C 0

1 Answer

0
 
Best answer

I had success with this example:

 

<?
       $curl = curl_init($service_url);
       //$curl_post_data = array(
       curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'X-AppSecretToken:MySecretToken',
            'X-AgreementGrantToken:MyGrantToken',
'Content-Type:application/json'
            ));
       curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($curl, CURLOPT_GET, true);
       //curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
       $curl_response = curl_exec($curl);
       curl_close($curl);
 
       $json = json_decode($curl_response);
  
  print "<pre>";
  print_r($json);
  print "</pre>";
?>
answered Feb 2, 2016 by donslund
selected Feb 11, 2016 by olej
Visma e-conomic A/S
...