Hi @MutedJam , thanks for your help.
I’ve already tried it this way, and it only shows that the form server has been authenticated.
But even if I give it code 200, it doesn’t recognize the API and doesn’t register the user on the site.
I’ve racked my brains.
The only documentation for the plugin to register users on the site is this one:
### create_user (create if not exists, else update existing Users/Members)
<?php
$op["op"] = "create_user"; // The Remote Operation.
$op["api_key"] = "296c096b6ac5c87d36b606842c76d6c2"; // 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.
"modify_if_login_exists" => "1", // Optional. Update/modify if ``user_login`` value already exists in the database?
// A non-zero value tells s2Member to update/modify an existing account with the details you provide, if this Username already exists.
"user_pass" => "456DkaIjsd!", // Optional. Plain text Password. If empty, this will be auto-generated.
"first_name" => "John", // Optional. First Name for the new User.
"last_name" => "Doe", // Optional. Last Name for the new User.
"s2member_level" => "2", // Optional. Defaults to Level #0 (a Free Subscriber).
"s2member_ccaps" => "music,videos", // Optional. Comma-delimited list of Custom Capabilities.
"s2member_registration_ip" => "123.456.789.100", // Optional. User's IP Address. If empty, s2Member will fill this upon first login.
"s2member_subscr_gateway" => "paypal", // Optional. User's Paid Subscr. Gateway Code. One of: (paypal|alipay|authnet|ccbill|clickbank|google).
"s2member_subscr_id" => "I-DJASODJF8933J", // Optional. User's Paid Subscr. ID. For PayPal®, use their Subscription ID, or Recurring Profile ID.
"s2member_custom" => "s2member.dev", // Optional. If provided, should always start with your installation domain name (i.e., $_SERVER["HTTP_HOST"]).
"s2member_auto_eot_time" => "2030-12-25", // Optional. Can be any value that PHP's ``strtotime()`` function will understand (i.e., YYYY-MM-DD).
"custom_fields" => array("my_field_id" => "Some value."), // Optional. An array of Custom Registration/Profile Field ID's, with associative values.
"s2member_notes" => "Administrative notation. Created this User via API call.", // Optional. Administrative notations.
"opt_in" => "1", // Optional. A non-zero value tells s2Member to attempt to process any List Servers you've configured in the Dashboard area.
// This may result in your mailing list provider sending the User/Member a subscription confirmation email (i.e., ... please confirm your subscription).
"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://jason.wpsharks.net/?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'];
}
And this is a new API_KEY that I’ve just generated, in case anyone wants to do some tests.
(@!B(TCTZDGWYA%)3%!P%BDDUK0KQQQS%Z^SHJSARDTRQB8SFDOV&CS20#@H#JYS
I’ve already checked everything I could.
I’ll keep trying and one day I’ll find a solution.
Thank you!