Revision: 46865
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 26, 2011 23:17 by rccc
Initial Code
public function executeGetLocation(sfWebRequest $request) { $ressource = $request->getParameter('ressource'); if(!empty($ressource)) { $query = "SELECT ?location WHERE {{ <" . $ressource . "> <http://dbpedia.org/ontology/locationCity> ?location }}"; $searchUrl = 'http://dbpedia.org/sparql?' . 'query='.urlencode($query) . '&format=json'; if (!function_exists('curl_init')){ die('CURL is not installed!'); } $ch= curl_init(); curl_setopt($ch, CURLOPT_URL, $searchUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); return $this->renderText( json_encode($response)); }
Initial URL
Initial Description
Initial Title
Sparql request with CURL
Initial Tags
curl
Initial Language
PHP