I have a CURL function:
function sendPost($posturl,$params,$use_ssl){
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
if($use_ssl)
$posturl = str_replace('http:','https:',$posturl);
curl_setopt($ch, CURLOPT_URL,$posturl);
if($use_ssl){
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
curl_close ($ch);
echo $result;
$array = array();
$pieces = explode('&',$result);
foreach($pieces as $val){
if($val){
$temp = explode('=',$val);
$array[$temp[0]]=$temp[1];
}
}
return $array;
}
I need to use it for the output of a form:
public function actionmemberSignup()
{
$membersignup=new MemberSignupForm;
if(isset($_POST['MemberSignupForm']))
{
$membersignup->attributes=$_POST['MemberSignupForm'];
$posturl = 'xxxxxxxxxxxxxxxx';
if($membersignup->validate())
{
$params = "action=user_create&account_id=xxxxxx&gateway_pass=xxxxxxxxxxxxxxxxx&user=$membersignup->loginname&pass=$membersignup->loginpw&email=$membersignup->email&first_name=$membersignup->fname&last_name=$membersignup->lname&address1=$membersignup->addr1&address2=$membersignup->addr2&city=$membersignup->city&state=$membersignup->state&zip=$membersignup->zip&country=$membersignup->country";
$makeuser = sendPost($posturl,$params,true);
Yii::app()->user->setFlash('membersignup','<br /><br /><center>Thankyou for joining . You now have access to all areas of our site.</center>');
$this->refresh();
}
}
$this->render('membersignup',array('membersignup'=>$membersignup));
}
I am new to Yii and MVC frameworks in general and could use some insight as to how to do this.