Here is a snippet of my code:
include("JSON.php");
$json = new Services_JSON();
$value=array('jsonrpc'=>'2.0', 'method'=>'methodname', 'params'=>array('param1',"param2"),'id'=>1);
$output = $json->encode($value);
print($output);
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept: application/json\r\n"."Content-type: application/json-rpc\r\n"."Content-Length:1000\r\n" ,
'user_agent' => 'spider',
'content'=>$output
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents('link', false, $context);
print($file);
$value = $json->decode($file);
?>
But I get this error:
[function.file-get-contents]: failed to open stream: HTTP request failed
I have tried seeing the settings in php.ini file, everyhting seems fine.
I tried file_get_contents('www.google.com')
and it worked.