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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -