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
Post a Comment