AnsweredAssumed Answered

Add User by CURL PHP

Question asked by lgonzalez on Jun 26, 2014
Latest reply on Jun 27, 2014 by lgonzalez
Hello Good Day,

I am trying add user by curl php, but don't add only sent me the admin info, here it's the code
      $data = array(
        "userName" => "ECASAS",
        "firstName" => "Eduardo",
        "lastName" => "Casas",
        "email" => "lgonzalez@emt.cl",
        "password"=>"asdasd"
      
      );


      $str_data = json_encode($data);

      $ch = curl_init();
      $username='admin';
      $password='*******';                    // initiate curl
      $url = "http://************/alfresco/service/api/people"; // where you want to post data
      curl_setopt($ch, CURLOPT_URL,$url);
      curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
      curl_setopt($ch, CURLOPT_POST, true);  // tell curl you want to post something
      curl_setopt($ch, CURLOPT_POSTFIELDS, $str_data); // define what you want to post
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format
      $output = curl_exec ($ch); // execute
      
      curl_close ($ch); // close curl handle
      
      var_dump($output); // show output
      
if sameone can help me please.

Outcomes