How to send s2member plugin's wordpress user data in json format to a url in php
I am using s2member pro plugin. I asked in plugin support too but no response tell yet. I want to send json data to a url using php, the server is located some where else forexample(//123.456.78,58:44005)/singleMethodname=JSONService___myfunctionofuserRegister() when he/she registers and or make any changes to their profile. s2member is suggesting this but its not what i need https://s2member.com/kb-article/building-an-api-notification-handler-webhook/
My code is
?php
header('Content-Type: application/json');
$fields = get_s2member_custom_fields();
$p_iva_field = $fields["p_iva"]["config"];
$user_detail[]= array(
$p_iva_field,
"user_login" = get_user_field ("user_login"),
"user_email" = get_user_field ("user_email"),
"first_name" = get_user_field ("first_name"),
"last_name" = get_user_field ("last_name"),
"full_name" = get_user_field ("full_name"),
"display_name" = get_user_field ("display_name"),
"company_name" = get_user_field ("user_comp"),
"user_cifiscale" = get_user_field ("user_cfisc"),
"partita_iva" = get_user_field ("p_iva"),
"coupon_code" = get_user_field ("s2member_coupon_codes"),
"s2member_custom" = get_user_field ("s2member_custom"), # Custom String value for the current User.
"s2member_subscr_id" = get_user_field ("s2member_subscr_id"), # Paid Subscr. ID for the current User.
"s2member_subscr_or_wp_id" = get_user_field ("s2member_subscr_or_wp_id"), # Paid Subscr. ID, else WordPress® User ID.
"s2member_subscr_gateway" = get_user_field ("s2member_subscr_gateway"), # Paid Subscr. Gateway Code for the current User.
"s2member_registration_ip" = get_user_field ("s2member_registration_ip"), # IP the current User had during registration.
"s2member_custom_fields" = get_user_field ("s2member_custom_fields"), # Associative array of all Custom Registration/Profile Fields.
"s2member_file_download_access_log" = get_user_field ("s2member_file_download_access_log"), # Associative array of all File Downloads by the current User, in the current Period (Period is based on a specific User'sallowed_days, configured in your Basic Download Restrictions, at the User's current Membership Level).
"s2member_file_download_access_arc" = get_user_field ("s2member_file_download_access_arc"), # Associative array of all File Downloads by the current User, in previous Periods (Periods are based on a specific User'sallowed_days, configured in your Basic Download Restrictions, at the User's Membership Levels in the past).
"s2member_auto_eot_time" = get_user_field ("s2member_auto_eot_time"), # Auto EOT-Time for the current User (when applicable).
"s2member_last_payment_time" = get_user_field ("s2member_last_payment_time"), # Timestamp. Last time an actual payment was received by s2Member.
"s2member_paid_registration_times" = get_user_field ("s2member_paid_registration_times"), # Timestamps. Associative array of all Paid Registration Times.
"s2member_access_role" = get_user_field ("s2member_access_role"), # A WordPress® Role ID (i.e. s2member_level[0-9]+, administrator, editor, author, contributor, subscriber).
"s2member_access_level" = get_user_field ("s2member_access_level"), # An s2Member Membership Access Level number.
"s2member_access_label" = get_user_field ("s2member_access_label"), # An s2Member Membership Access Label (i.e. Bronze, Gold, Silver, Platinum, or whatever is configured).
"s2member_access_ccaps" = get_user_field ("s2member_access_ccaps"), # An array of Custom Capabilities the current User has (i.e. music,videos).
"s2member_login_counter" = get_user_field ("s2member_login_counter"), # Number of times the User has logged into your site.
);
echo wp_json_encode($user_detail, JSON_PRETTY_PRINT);
?