Need help with an 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

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

Need help with an API call

Post by suavebum »

My company is trying to create on demand emails through MyEmma (A newsletter site) using an API call. They have provided me with this sample code:
  • PHP w/ PEAR's HTTP_Client package
    require_once("HTTP/Client.php");
    $emma_client = new HTTP_Client();
    $emma_client->setMaxRedirects(20);

    // POST should be filtered appropriately
    $_POST['emma_account_id'] = '2975';
    $_POST['signup_post'] = '24863';
    $_POST['username'] = '**username**';
    $_POST['password'] = '**password**';
    $_POST['group'][5376249] = 1;
    $_POST['emma_member_name_first'] = 'Bob';
    $_POST['emma_member_email'] = 'bob@smith.com';

    $emma_client->post("https://app.e2ma.net/app/view:RemoteSignup", $_POST);
    $response_code = $emma_client->currentResponse();
I have never used PHP before and we are trying to keep this in house instead of using our contractors. Unfortunately, no one in house knows PHP and so this project has fallen on me and I am at a loss of where to start. :(

I first just want to create a simple html file with 2 text boxes for member first name and member email just to test it. Would the best way be to put this code into the html file? Or to call a PHP file through the html file?

Any suggestions on how to get this working, or where to find more information would be greatly appreciated.

Thank you.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Need help with an API call

Post by John Cartwright »

Duplicate.. Hrmm... Locked.

Also, [list][/list] tags arn't meant for posting PHP code, instead please use [syntax=php][/syntax]
Locked