I am try to add candidate record from WordPress but getting error. This is the code that i have written please help me what am i doing wrong.
function get_fields_by_ajax_callback() {
check_ajax_referer('get_fields','security');
$firstname= $_REQUEST['firstname'];
$lastname= $_REQUEST['lastname'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$nationality = $_REQUEST['nationality'];
$age = $_REQUEST['age'];
$location = $_REQUEST['location'];
$languages = $_REQUEST['languages'];
$gender = $_REQUEST['gender'];
$current_employer = $_REQUEST['current_employer'];
$Current_job_title = $_REQUEST['Current_job_title'];
$qualification = $_REQUEST['qualification'];
$last_emp_details = $_REQUEST['last_emp_details'];
$function1 = $_REQUEST['function1'];
$industry = $_REQUEST['industry'];
$salary = $_REQUEST['salary'];
$experience = $_REQUEST['experience'];
$xml='
<Candidates>
<row no="1">
<FL val="First name">'.$firstname.'</FL>
<FL val="Last name">'.$lastname.'</FL>
<FL val="Email ID">'.$email.'</FL>
<FL val="Contact number">'.$phone.'</FL>
<FL val="Total work exp">'.$experience.'</FL>
<FL val="Current job title">'.$Current_job_title.'</FL>
<FL val="Current employer">'.$current_employer.'</FL>
</row>
</Candidates>'
;
//echo $url;
include_once( ABSPATH . WPINC. '/class-http.php' );
$request = new WP_Http;
$result = $request->request( $url1, array( 'method' => 'POST', 'body' => $xml) );
if($result){ echo "updated";}else{echo "not updated";}
wp_die();
}
Also getting error when i make an api request to addrecords using postman.