Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receive JSON object from HTTP Get in PHP

Tags:

json

http

php

I am trying to implement a php client that sends an HTTP GET to the server which sends back a JSON object with the return information. I know how to decode the JSON once my php script has received it, but how would I go about actually getting it?


EDIT: Note - I send the server an HTTP GET, and it generates and sends back a JSON file. It is not a file sitting on the server.

like image 441
DevinFalgoust Avatar asked Dec 21 '22 23:12

DevinFalgoust


1 Answers

Check out file_get_contents

$json = file_get_contents('http://somesite.com/getjson.php');
like image 56
webbiedave Avatar answered Dec 24 '22 02:12

webbiedave