A noob needs help with a MyEmma API call

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
suavebum
Forum Newbie
Posts: 3
Joined: Tue Sep 22, 2009 11:02 am

A noob needs help with a MyEmma API call

Post by suavebum »

So all my programmers are busy right now and I need to test out the on demand email feature of MyEmma by signing up a user using an API call. Unfortunately I haven't used HTML since high school, and have never used PHP (Other than pre-built PHP items). So my thought was to create an HTML page with a simple form, first name and email address. This is to be sent to MyEmma for uploading into my database of consumers. Here is the code for the simple HTML page I created:

<html>
<head>
<title>Personal INFO</title>
<?php
$_POST['emma_member_name_first'] = $emma_member_name_first;
$_POST['emma_member_email'] = $emma_member_name_email;
?>
</head>
<body>
<form method="post" action="/submitForm.php" onsubmit="return validateForm(this);">
<div align="center">
<table border="0" cellpadding="3" cellspacing="0">
<tbody><tr>
<td nowrap="nowrap" valign="top"><strong><font face="Verdana" size="2">First Name:</font></strong></td>
<td valign="top">
<font face="Verdana">
<!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="50" --><input name="emma_member_name_first" size="30"

maxlength="50" /></font><font face="Verdana" size="2">*</font><font face="Verdana">

</font> </td>
</tr>
<tr>
<td nowrap="nowrap" valign="top"><strong><font face="Verdana" size="2">Email:</font></strong></td>
<td valign="top">
<font face="Verdana">
<!--webbot bot="Validation" b-value-required="TRUE" i-maximum-length="50" --><input name="emma_member_email" size="30"

maxlength="50" /></font><font face="Verdana" size="2">*</font><font face="Verdana">

<tr>
<td><strong><font face="Verdana" size="2">&nbsp;</font></strong></td>
<td valign="top"><input value="Submit" type="submit" name="submit" />&nbsp;&nbsp;<input value="Reset" type="reset" /></td>
</tr>
</form>
</body>


Then I figured linking it to a php page would work. (Someone please correct me if I should use all the code in one html or php page as opposed to calling the PHP page.)

MyEmma gave me some sample code to use in PHP w/ PEAR. It is the code that follows:


require_once(HTTP/submitForm.php"
$emma_client = new HTTP_Client();
$emma_client->seMaRedirects(20);

// POST should be filtered appropriately
$_POST['emma_account_id'] = '12345';
$_POST['signup_post'] = '54321';
$_POST['username'] = '**username**';
$_POST['password'] = '**password**';
$_POST['group'][123456] = 1;
$_POST['emma_member_name_first'] = 'bob';
$_POST['emma_member_email'] = 'bob@smith.net;

$emma_client->post("https://app.e2ma.net/app/view:RemoteSignup", $_POST);
$response_code = $emma_client->currentResponse();



So... I directed my html page to a php file with this code:


<?php
require_once(HTTP/submitForm.php"
$emma_client = new HTTP_Client();
$emma_client->seMaRedirects(20);

// POST should be filtered appropriately
$_POST['emma_account_id'] = '12345';
$_POST['signup_post'] = '54321';
$_POST['username'] = '**username**';
$_POST['password'] = '**password**';
$_POST['group'][123456] = 1;
$_POST['emma_member_name_first'] = $emma_member_name_first;
$_POST['emma_member_email'] = $emma_member_email;

$emma_client->post("https://app.e2ma.net/app/view:RemoteSignup", $_POST);
$response_code = $emma_client->currentResponse();
?>


Obviously, it's not working. It's not adding any contacts to MyEmma. Any suggestions on where I could be going wrong? Whenever I try to post the PHP code in the title of my HTML page, the ->'s always screw up the coding and everything after a -> is displayed on the screen.

I really appreciate any help. Unfortunately I am brand new to PHP. Thank you very much!

(Usernames and passwords hidden for obvious reasons)
suavebum
Forum Newbie
Posts: 3
Joined: Tue Sep 22, 2009 11:02 am

Re: A noob needs help with a MyEmma API call

Post by suavebum »

Please help. Desperate.
Post Reply