Jump to content

Need some help with API (newb questions)


awdrifter

Recommended Posts

I'm doing a school project, and basically I'm trying to get these APIs to work. What I need is to when a customer fills out a form on my website, their email is automatically added to the contact list on BenchmarkEmail.

 

ttp://www.benchmarkemail.com/API/Examples

 

I tried to edit their sample code with my account info and just running the php file, just to see if it'll add the email address to the contact list. But I couldn't get it to work. Any help or links to may some better samples would help. Thanks in advance.

 

Link to comment
https://forums.phpfreaks.com/topic/235459-need-some-help-with-api-newb-questions/
Share on other sites

I tried to do some trouble shooting by myself, I got down to basically it's not able to connect to their API for some reason. Here's the simplest simple code I've found on their website, it's just getting a token. But when I ran it I got a blank screen, no error code, not even the "Your Token Is:" text. I have Xampp installed btw, which should have all the PHP stuff required.

 

http://www.benchmarkemail.com/API/Start/Login

 

<?php
/**
* 
* This Example shows how to authenticate a user using XML-RPC.
* Note that we are using the PEAR XML-RPC client and recommend others do as well.
*/

require_once 'XML/RPC2/Client.php';

// Account Settings 
$USERNAME = 'my actual username';
$PASSWORD = 'my actual password';
$API_URL = 'http://api.benchmarkemail.com/1.0'; 


try 
{
     // Create the XML RPC Object 
    $client = XML_RPC2_Client::create($API_URL);

     // Authenticate the user 
    $token = $client->login($USERNAME, $PASSWORD);

     // Print the token 
    echo "Your Token is :" . $token;

} catch (XML_RPC2_FaultException $e){
     echo "ERROR:" . $e->getFaultString() ."(" . $e->getFaultCode(). ")";
}


?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.