curl-and-php
Trying to automatically post a form with CURL
Date: Wed, 26 Jul 2006 16:31:31 -0400
I've built a software application that works totally on the web. It's a
program that runs in your browser and it's used to keep our mailing list
information up to date so we get the most out of our marketing. We have a
staff that constantly calls people out of our database and this app is used
to keep the data current. I've created it from scratch using PHP and MySQL.
I like it, the operators like it, my boss likes it, etc. It's works fine and
updates the data locally just fine.
Anyway, the main form that the operators use is just a large HTML form built
of text fields that have address, phone, fax info for people that have said
it's ok to try to sell to them. I'm building an addition to this application
that sets up a new contact in our database. When a new contact is set up, a
basic HTML form must be filled out and sent to our list builder. I'm trying
to automate that process so that the operators do not have to enter that
information twice.
Ok, here's my problem: If I use the form in internet explorer it will submit
the contact information as a new record and that will be received as a
"verified" submittal. If I submit the same contact via auto HTTP post with
CURL that contact is considered "unverified" and emails this person
(prompting nasty call). Is there something I'm missing here?
Here's my PHP/CURL code:
if ($_POST['submit_this'] == 'on') {
$curl_list = curl_init();
curl_setopt($curl_list, CURLOPT_URL,
'http://www.aweber.com/scripts/addlead.pl');
//curl_setopt ($curl_list, CURLOPT_POST, 1);
// setup fields for form submittal
$post_fields = "meta_web_form_id=" . $row['Webform'];
$post_fields .= "&meta_split_id=";
$post_fields .= "&unit=" . $row['Unit'];
$post_fields .= "&redirect=http://www.mydomain.com/submit_ok.html";
$post_fields .= "&meta_adtracking=onlineApp";
$post_fields .= "&meta_message=1";
$post_fields .= "&meta_required=from,name";
$post_fields .= "&meta_forward_vars=0";
$post_fields .= "&from=" . $_POST['Email'];
$post_fields .= "&name=" . $_POST['FirstName'] . " " .
$_POST['LastName'];
$post_fields .= "&custom Company=" . $_POST['Company'];
$post_fields .= "&custom Address=" . $_POST['StreetAddress'] . " " .
$_POST['StreetAddress2'] . " " . $_POST['City'] . ", " . $_POST['State'] . "
" . $_POST['Zip'];
$post_fields .= "&custom Phone Number=" . $_POST['Phone'];
$post_fields .= "&custom Operator=" . $operator_name;
$post_fields .= "&custom Comments=" . $_POST['Comments'];
$post_fields .= "&custom CID=" . $_POST['CID'];
curl_setopt ($curl_list, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt ($curl_list, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($curl_list, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($curl_list);
//echo $curl_list . "\n\n\n" . $post_fields . "\n\n\n" . $store;
}
Can you see anything I should or could set to tell our listing service's
servers that this submittal is verified? All of those fields are set exactly
to the values they should be set to and I know that they all work because
they all show up in the contacts listing on the listing service's server. It
will have the phone, fax, address, zip everything, but it will be
"unverified" -> email -> nasty call.
Any ideas?
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-07-26