1function url_get_contents ($Url) {
2 if (!function_exists('curl_init')){
3 die('CURL is not installed!');
4 }
5 $ch = curl_init();
6 curl_setopt($ch, CURLOPT_URL, $Url);
7 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
8 $output = curl_exec($ch);
9 curl_close($ch);
10 return json_decode($output,JSON_OBJECT_AS_ARRAY);
11}
1Actually php://input allows you to read raw POST data.
2
3It is a less memory intensive alternative to $HTTP_RAW_POST_DATA and does not need any special php.ini directives.
4
5php://input is not available with enctype="multipart/form-data".
6
7Reference: http://php.net/manual/en/wrappers.php.php