如何以JSON格式加载外部托管数据

What would the syntax be to pull an external data source, which has the data in JSON format into a variable to be worked with. I understand using json_decode($variable) but how would i load the actual data into that variable for decoding?

If by external you mean that it's hosted on a 3rd-party domain name, then you open a socket and GET the data:

$variable = file_get_contents('http://example.com/data.json');
$decoded = json_decode($variable);

Using file_get_contents() ? (You must have allow_url_fopen true)

With fopen(), fread(), and fclose(), or with file_get_contents().

Use anything from fopen + fread to php curl library. With fopen you could open a remote file if php settings allows you to. I think you should be able to do it now. If you still can't do it, let us know.