I have to create a module that return a list of my language, only the list without template,and I have to call this url via curl
I create something like this ( inside my module )
function my_module_menu() {
$items['my_module'] = array( //URL
'page callback' => 'get_all_languages',
'access arguments' => array(''),
);
return $items;
}
/**
* @return string
*/
function get_all_languages() {
$out = array();
$result = language_list('enabled');
foreach ($result as $key => $value) {
foreach ($value as $k => $v) {
$out[$v->language] = $v->name;
}
}
$p = json_encode($out);
print $p;
drupal_exit();
}
I tried also
drupal_add_http_header('Content-Type', 'application/json');
$p = drupal_json_encode($out);
But this url is not Json infact if call this url by Curl, I can see all the template. I want to have the result like using this module, or can i Create a view that use my module result?
I have another problem when use curl, my content is
You are not authorized to access this page.