parse.com - Error in create new user with PHP SDK -
i getting error trying create new user php sdk
error output
you must specify parse class name or register appropriate subclass when creating new object. use parseobject::create create subclass object.
php file
$user = new parseuser(); $user->set("username", "test"); $user->set("email", "test@gmail.com"); $user->set("password", "cf%09ude"); try { $user->signup(); $result = true; } catch (parseexception $ex) { echo "error: " . $ex->getcode() . " " . $ex->getmessage(); }
you failed initialize sdk parseclient::initialize
. correct usage after loading autoload.php
is:
use parse\parseclient; use parse\parseuser; $app_id = 'your_app_id'; $rest_key = 'your_rest_key'; $master_key = 'your_master_key'; parseclient::initialize($app_id, $rest_key, $master_key); $user = new parseuser(); $user->set("username", "test"); $user->set("email", "test@gmail.com"); $user->set("password", "cf%09ude"); try { $user->signup(); $result = true; } catch (parseexception $ex) { echo "error: " . $ex->getcode() . " " . $ex->getmessage(); }
the above code tested , works correct api keys filled in - , able reproduce error commenting out parseclient::initialize
line. i've submitted pull request github show more descriptive exception scenario.
Comments
Post a Comment