<?php// this would be in its own include filedefine('API_ENDPOINT', 'http://127.0.0.1/nexus/ws.php');if (!function_exists('curl_init')) die; // gotta have curl for this one.function isFormValid(){ // error checking for $_POST goes here. return true;}function submitRegistration(){ if (!isFormValid()) { return false; } // this would be abstracted to a proper POSTing class $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, API_ENDPOINT); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $formdata = $_POST; foreach($_COOKIE as $k=>$v) $formdata['cookie_'.$k] = $v; $formdata['reqtype'] = 'newlead'; curl_setopt($ch, CURLOPT_POSTFIELDS, $formdata); return curl_exec($ch);}?>