lundi 24 juin 2019

Looking for PHP code example to connect to a webapi using a bearer-token authentication

Need to connect to a webapi using bearer-token authentication preferably in PHP. Looking for sample code, first time doing this and I am a little lost. The instructions for the api call is something like this: https://api.mlsgrid.com/PropertyResi?$filter=ModificationTimestamp%20gt%202018-12-30T23:59:59.99Z

I am not sure how to setup header and the request object. Any suggestions or sample code would be great.

Tried a lot of variations of the code. I have seen a lot of code example snippets but nothing that covers the basics of putting together the calls.

    <?php
``http.Request.Headers.Add("Authorization", "Bearer tokennumber");

request.get('https://api.mlsgrid.com/PropertyResi?$filter=ModificationTimestamp%20gt%202018-12-30T23:59:59.99Z', 
{
'auth': {
'bearer': 'tokennumber'
}
});

request.get('https://api.mlsgrid.com/xxxxx$filter=MlgCanView%20eq%20true/', 
{
'auth': {
'bearer': 'tokennumber'
}
});


?>




Aucun commentaire:

Enregistrer un commentaire