sixseven Posted June 20, 2011 Share Posted June 20, 2011 Hi there, I have a simple form online set up to email contact info and and some selections to an inbox. Simple enough. I now want the back end php code that emails me that info to also send my email marketing account the contact information. I was told to look into cURL, which I have been, and can't seem to figure it out. I get all the field names and place them into variables. I was given the string in the variable $url to use in order to send the info to our email lists. I tried using the code below but it didn't work. I'm having a hard time understanding how to use cURL and was curious if anyone could shed some light. Many thanks to anyone with answers. $EmailFrom = Trim(stripslashes($_POST['fields_email'])); $FirstName = Trim(stripslashes($_POST['fields_fname'])); $LastName = Trim(stripslashes($_POST['fields_lname'])); $Street1 = Trim(stripslashes($_POST['fields_address1'])); $Street2 = Trim(stripslashes($_POST['fields_address2'])); $City = Trim(stripslashes($_POST['fields_city'])); $State = Trim(stripslashes($_POST['fields_state'])); $Zip = Trim(stripslashes($_POST['fields_zip'])); $Country = Trim(stripslashes($_POST['fields_country'])); $url = "https://app.email.com/icp/signup.php?fields_email&fields_fname&fields_lname&fields_address1&fields_address2&fields_city&fields_state&fields_zip&fields_country&listid=XXXXXX&specialid:XXXXXX=SCCG&clientid=XXXXXX&formid=XXXX&reallistid=1&doubleopt=0&redirect=http://www.email.com/www/signup/thanks.html&errorredirect=http://www.email.com/www/signup/error.html"; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); $result = curl_exec($ch); curl_close($ch); Link to comment https://forums.phpfreaks.com/topic/239925-curl-question/ Share on other sites More sharing options...
fa11en Posted June 20, 2011 Share Posted June 20, 2011 Hello! Try this: <?php $some_var = trim( stripslashes( $_POST['some_var'] ) ); $some_var2 = trim ( stripslashes( $_POST['some_var2'] ) ); $url = "https://https.host.com/app.php?some_var={$some_var}&some_var2={$some_var2}"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1); // to return result into var /* !!!IMPORTANT!!! do not verify ssl sertificate */ curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0); /** to send POST request: curl_setopt ($curl, CURLOPT_POST, 1); curl_setopt ($curl, CURLOPT_POSTFIELDS, "some_var={$some_var}&some_var2={$some_var2}"); // POST data */ $result = curl_exec ($curl); echo htmlspecialchars($result); // Display result ?> Link to comment https://forums.phpfreaks.com/topic/239925-curl-question/#findComment-1232448 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.