<?php

//$url = 'http://localhost:2020/update/service';

$url = 'http://localhost:2020/ont';
$data = file_get_contents("query");
$fields = array(
			//'request'=>urlencode($data)
            'query'=>urlencode($data),
            'output'=>urlencode('json')
        );
foreach($fields as $key=>$value) {
	$fields_string .= $key.'='.$value.'&';
}
rtrim($fields_string,'&');

$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HTTPHEADER,array('User-Agent: SOH/Fuseki 0.0.0'/*, 'Content-Type: application/sparql-update'*/));
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
//execute post
$result = curl_exec($ch);
print_r($results);
//close connection
curl_close($ch);