Hi everyone, I have a project I'm working on where I am collecting data for a client on a form I host. They use "MailApe" (you know who I'm talking about), who aren't a very helpful group of monkeys. I need to collect the data to my db from my form, which is all well and good, but when the person opts-in for the client's newsletter, I want my PHP validation script to send the email address to their "MailApe" account via their API. I'm trying to use this "header" function, but It's not working. Should I try something else?

if($_REQUEST['optin'] == 'yes'){
	header("Location: http://us1.api.mailape.com/1.3/?method=listSubscribe")
...

Any ideas?

Thanks!!!

if($_REQUEST['optin'] == 'yes'){
    header("Location: http://us1.api.mailape.com/1.3/?method=listSubscribe")
  $result= mysql_query(" select attribute FROM Table WHERE attribute=$attribute");
  mysql_fetch_array($result);

How you start a session?

if($_REQUEST['optin'] == 'yes'){
    header("Location: http://us1.api.mailape.com/1.3/?method=listSubscribe")
  $result= mysql_query(" select attribute FROM Table WHERE attribute=$attribute");
  mysql_fetch_array($result);

How you start a session?

I start with extraction via the POST method then some error checking, then dump the data to the MySQL db like this:

<?php
extract($_POST);

if($_REQUEST['fname'] == ''){
	echo "\nYou must complete the Name field.<p>";
  $error++;
}
if($_REQUEST['lname'] == ''){
	echo "\nYou must complete the Last Name field.<p>";
  $error++;
}
}

Then I have pregmatch and error output. All basic stuff.

I have been playing with their API and trying some techniques they haven't offered, like encoding the URL with the client key, etc., like so:

if($_REQUEST['optin'] == 'yes'){
	$_Get['$email'];
	header("Location: http://us1.api.mailape.com/1.3/?method=listSubscribe&apikey=[APIKEY]&id=[CLIENTID]&email_address=[EMAIL]&output=php");

I can get that to work in my browser if I replace [EMAIL] with mine and paste it into my address bar - it signs me right up. I guess I need help using the $email call in the URL too.

Thanks for your help!

GJ

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.