Troublehshooting Pro API For Remote Operations

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']; } ?>

i found the issue, now looking for a way to solve it. the software i am using to create the new user is hosted on the same server but in a different subdomain, the request coming from the same IP seems to prevent the api from registering the user. is there a setting to allow the ip? or set an allowed ip?

Sean

Can not you move or copy the “software that creates the new user” to same subdomain, or “mimic” it as WP plugin? Then you may use usual hooks, instead HTTP calls…

Also, can that software run an HTTP call to the URL of the site you need to create the new member?

Well, most likely I miss something with your logic, but hope that helps you to think in different direction…

no sure how i would “mimic” a CRM as a wordpress plugin, the api already posts to a URL within s2member so i am trying to use functionality that already exists within s2member. the api uses the “usual hooks” i thought maybe there was a setting somewhere i missed that would set allowed IP’s. Jason seems to think its a firewall issue. i am still checking into this and will report back in case anyone else has similar issues.

Sorry, my fault… Yes, check for FW issues, or HTTPS issues too…