Problem with ushahidi api


Hi there!

I created this script:

	<title>Uso de API de Ushahidi</title>

	<meta charset="UTF-8">	

	$session = curl_init('');
	curl_setopt ($session, CURLOPT_POST,1);
	//le decimos qué parametros enviamos 
	curl_setopt ($session, CURLOPT_POSTFIELDS, "");

	$respuesta = curl_exec($session);

	if($respuesta != 0)
		echo "<br>Usuario creado exitosamente en Ushahidi!!!!";
		curl_close ($session);
		echo "<br>Imposible crear usuario en base de datos de ushahidi<br>";
		curl_close ($session);*/



To connect with this function inside the ushahidi Api:

public function new_user()

        if(isset($_POST['name']) AND isset($_POST['apellido']) AND isset($_POST['email']) AND isset($_POST['identificacion']) AND isset($_POST['password']))
            echo "El usuario que intenta ingresar en la BD de Ushahidi es:";
            echo "<br>Nombre: ".$_POST['name'];
            echo "<br>Apellido: ".$_POST['apellido'];
            echo "<br>Email: ".$_POST['email'];
            echo "<br>Identificacion: ".$_POST['identificacion'];
            echo "<br>Contraseña: ".$_POST['password'];

            return 0;
            echo "No se ha ingresado algún usuario.";
            return 1;

The function is inside of: My_private_func_api_object.php file, and it is charged on api.php like this:

"newuser" => array("System", "new_user")

when i run my scrip i get this error that i can not find the solution:

{"code":"001","message":"Falta un par\u00e1metro - task."}

I hope you can give me a hand.


It seems your curl call is not sending the task variable as part of the Post variables


curl_setopt ($session, CURLOPT_POSTFIELDS, "");


You were right, it works now. Thank you for your help.