false,'error'=>'unspecified error'); $body = array( 'token' => $apitoken, 'extension' => $extension, 'country' => $country, 'maxparticipants' => $maxparticipants, 'phpsessionid' => session_id(), 'clientip' => $_SERVER['REMOTE_ADDR'] ); $args = array( 'body' => $body, 'timeout' => '5', 'redirection' => '5', 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'cookies' => array() ); $response = wp_remote_post( 'https://'.$fqdn.'/api/webinar/login', $args ); $http_code = wp_remote_retrieve_response_code( $response ); $body = wp_remote_retrieve_body( $response ); if ($http_code==200){ $res = @json_decode($body, true); if (!is_array($res) || empty($res) || empty($res['sessionId'])){ $reply['error'] = 'Invalid reply'; } else { $reply['sessionid']=$res['sessionId']; $reply['result']=true; $reply['error']=''; } } else { $reply['error']='Request failed: '.$http_code; } return $reply; } ?>