Services returns false
I'm trying to make a new site in aegir via a service. But when I send my request it returns a boolean false / empty array.
I can login with the same service. No problem there. The resource is active and the permissions are also right.
Anyone an idea?
[code] // Server REST - node.create $request_url = 'http://host/service/hosting_site/';
// node data $node_data = array( 'url' => 'test', 'data' => array( // REQUIRED FIELDS 'title' => 'test', 'type' => 'site', 'profile' => 'hostmaster', 'platform' => 'hostmaster', 'site_language' => 'nl', 'db_server' => 'localhost', 'client' => 'api', ), ); $node_data = http_build_query($node_data);
// Define cookie session $cookie_session = $logged_user->session_name . '=' . $logged_user->sessid;
// cURL $curl = curl_init($request_url); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json')); // Accept JSON response curl_setopt($curl, CURLOPT_POST, 1); // Do a regular HTTP POST curl_setopt($curl, CURLOPT_POSTFIELDS, $node_data); // Set POST data curl_setopt($curl, CURLOPT_HEADER, FALSE); // Ask to not return Header curl_setopt($curl, CURLOPT_COOKIE, $cookie_session); // use the previously saved session curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl, CURLOPT_FAILONERROR, TRUE);
$response = curl_exec($curl); $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($http_code == 200) { // Convert json response as array $node = json_decode($response); } else { // Get error msg $http_message = curl_error($curl); die($http_message); }
print_r('node: '); print_r($node);
curl_close($curl); unset($curl); [/code]
My return: [code] loggedin node: Array ( [0] => ) [/code]
No recent comments found.