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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -