无法使用PHP cURL在quickblox上注册用户

时间:2015-06-10 10:28:10

标签: php curl quickblox

我使用quickblox的会话休息调用令牌

现在我想在quickblox上注册我的用户,但是作为对cURL的回复: {"代码":null,"消息":"未提供任何数据"}

我写了以下代码:

<pre><code>
$token = '66575f5085173718a73d74781223d0bc14e3abb1';
$post_body = http_build_query(array(
                    'login' => 'test1436547745678568768',
                    'password' => 'test1',
                    'email' => 'test1@test1.com',
                    'external_user_id' => '68764641',
                    'facebook_id' => '',
                    'twitter_id' => '',
                    'full_name' => 'test1 test1',
                    'phone' => '',
                    'website' => '',
                    'tag_list' => '',
                    ));

$signUpCurl = curl_init();
curl_setopt($signUpCurl, CURLOPT_URL, self::QB_API_ENDPOINT . '/' . self::QB_PATH_USER);
curl_setopt($signUpCurl, CURLOPT_HTTPHEADER, array("QB-Token: ".$token));
curl_setopt($signUpCurl, CURLOPT_POST, true);
curl_setopt($signUpCurl, CURLOPT_POSTFIELDS, $post_body);
curl_setopt($signUpCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($signUpCurl, CURLOPT_SSL_VERIFYPEER, FALSE);

$responce = curl_exec($signUpCurl);

// Check errors
if ($responce) {
  echo $responce . "\n";
} else {
  $error = curl_error($signUpCurl). '(' .curl_errno($signUpCurl). ')';
  echo $error . "\n";
}

// Close connection
curl_close($signUpCurl);

return ' signUp ';</code>

请帮助我得到正确答案。

1 个答案:

答案 0 :(得分:-3)

//将所有字段作为用户数组传递。

var registro = new Registro();
registro.cargarFormulario("formularioRegistro");

function verificar(){
    registro.verificarMail();
}

function limpiarCampos(){
    registro.Limpiar();
}

function botonRegistrar(){
    registro.Registrar2();
}