suavebum Posted September 22, 2009 Share Posted September 22, 2009 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"> </font></strong></td> <td valign="top"><input value="Submit" type="submit" name="submit" /> <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'] = '[email protected]; $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) Link to comment https://forums.phpfreaks.com/topic/175137-never-used-php-before-need-help-with-an-api-call/ Share on other sites More sharing options...
suavebum Posted September 23, 2009 Author Share Posted September 23, 2009 Could someone at least suggest if it's better to do an API call by calling a PHP script from an HTML page, or would it be best to incorporate it all into one HTML page with some PHP scripting? Link to comment https://forums.phpfreaks.com/topic/175137-never-used-php-before-need-help-with-an-api-call/#findComment-923447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.