All pastes #2045204 Raw Edit

Stuff

public php v1 · immutable
#2045204 ·published 2011-04-11 19:18 UTC
rendered paste body
<?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);}?>