JSON Request
-
Hello , i think your plugin is greate , however i am having trouble understanding how it works , i need to connect the registration form input data , with this json request and then get the response to be registered with the user data as well .
this is the request
$postData = array(“data” => json_encode(array(
“MasterID” => “test”,
“MasterPassword” => “test”,
“IsDemo” => “true”,
“Password” => “$user password “, //this is required
“FirstName” => “$first_name”, // this is required
“LastName” => “$last_name”, //this is required
“Email” => “$user_email”,
“CountryCitizenshipId” => “”,
“State” => “”,
“City” => “”,
“Address” => “”,
“PhoneCountryCode” => “1”,
“PhoneAreaCode” => “”,
“PhoneNumber” => “Addtional field1”,
“Zip” => “”,
“IdentityType” => “”,
“IdentityNumber” => “”,
“Comments” => “wp-register integration”
)));$parameters = http_build_query($postData, “”, “&”);
// Setup cURL
$ch = curl_init(‘https://xxxxxx/Open_WL_Account_New’);
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => FALSE,
CURLOPT_SSL_VERIFYPEER => FALSE, //throws SOAP error when this is FALSE
//CURLOPT_CAINFO => “/etc/cacert.pem”, //tried different CAs here, nothing worked
CURLOPT_POSTFIELDS => $parameters,
CURLOPT_RETURNTRANSFER=>1
));// Send the request
$response = curl_exec($ch);// Check cURL errors
if($response === FALSE){
echo ‘curl fail’;
die(curl_error($ch));
}$response_xml = simplexml_load_string($response);
print_r($response_xml); // Print raw responseAny idea how to put this code?. the response also comes in the following manner
{“IsOK”:”TRUE”, “Message”:”Account created successfully”, “AccountUsername”:”8506″, “AccountPassword”:”Aa123″} the password is the same as the registration form , but the account username comes from the response , any idea how to capture it and register it as an additional Field to be viewed on the user profile?.
Any help would be appreciated , thank you.
- The topic ‘JSON Request’ is closed to new replies.