json - How to set content-type on PHP Get Request? -


sorry if simple new rest requests. trying make request rest api have been provided getting 415 error (unsupported media type).

here (very basic) code :

<?php  header('content-type: application/json;charset=utf-8;');  $url = "https://opsview.somedomain.net/rest"; $response = file_get_contents($url); echo $response;  ?> 

the api connected says supports json or xml not sure why getting error? ideas?

any appreciated.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -