i am trying to create a user with the Pro API For Remote Operations. i have narrowed it down to the simplest method, creating a new user with just a username and email and send the new user email.
when i run the script, no user is created, nothing is returned to the test.php page and no errors are generated.
i have verified the api_key and even created a very simple one with no special characters.
debugging is enabled and nothing shows up in the log files.
s2-server-scanner.php returns all green on both http and https.
anything i may be missing? there is little documentation other than the comments in the code.
i have enabled registration in different ways.
here is the code i am using. taken directly from the examples with all of the optional lines removed except for the notification email setting.
<?php $op["op"] = "create_user"; // The Remote Operation. $op["api_key"] = "applesandoranges"; // Check your Dashboard for this value. // See: `s2Member → API / Scripting → Remote Operations API → API Key` $op["data"] = array( "user_login" => "johndoe22", // Required. A unique Username. Lowercase alphanumerics/underscores. "user_email" => "johndoe22@example.com", // Required. A valid/unique Email Address for the new User. // These additional details are 100% completely optional. "notification" => "1", // Optional. A non-zero value tells s2Member to email the new User/Member their Username/Password. // The "notification" parameter also tells s2Member to notify the site Administrator about this new account. ); $post_data = stream_context_create(array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => 's2member_pro_remote_op='.urlencode(json_encode($op))))); $result = json_decode(trim(file_get_contents('https://mydomain.com/?s2member_pro_remote_op=1', false, $post_data)), true); if ($result && empty($result['error']) && !empty($result['ID'])) { echo 'Success. New user created with ID: '.$result['ID']; } elseif (!empty($result['error'])) { echo 'API error reads: '.$result['error']; } ?>