PHP Example for API connection

Andy Simpson Posted in Beginning Developers 4 years ago

I was wondering if someone could please provide me with a working PHP example (full source) of how to interact with the API provided by the OSSN Services component. I have the API key but do not understand how to structure the syntax of my calls to the API.

Thank you

Replies
Indonesian Arsalan Shah Replied 4 years ago

Andy, this is basic example of work, you can write your own method to utilize this api.

au Andy Simpson Replied 4 years ago

I worked it out, this is how you do it

<?php
$url= 'https://<insert URL/GQDN here>/api/v1.0/user_details?api_key_token=<insert your API key here>&guid=1';

$arrContextOptions=array(
      "ssl"=>array(
            "verify_peer"=>false,
            "verify_peer_name"=>false,
        ),
    );

$response = file_get_contents($url, false, stream_context_create($arrContextOptions));
echo "<pre>";
print_r($response);
echo "</pre>";
?>
us David Vaccaro Replied 4 years ago

I would like that too.