cancel
Showing results for 
Search instead for 
Did you mean: 

Sample code worked Friday, not working today

I'm just trying to get started integrating CIM with a client's site. I use PHP, and the code shown below worked last Friday. It issued a confirmation message and a new customer profile number. Today, without any changes whatever, it does nothing. Interestingly, when I called the help desk and they asked me for the response string, I tried to echo the string to the screen so that I could fulfill their request. Not only will the string not display, it crashes the program entirely, and an echo after that line never is performed. I'm stymied!

 

<?

$link_id = mysql_connect("localhost", "reowned", "Claude8812");

mysql_select_db("reowned", $link_id);

$first=$_GET['first'];

$last=$_GET['last'];

$email=$_GET['email'];

$type=$_GET['type'];

$sql="insert into applicants (type, first, last, email, status) values (" . $type . ",'" . $first . "', '" . $last . "', '" . $email . "', 1)"; echo $sql;

//mysql_query($sql) or die("died");

//$query="SELECT last_insert_id()"; //$db_data=mysql_query($query); //while($rslast=mysql_fetch_array($db_data)) {

//$id=$rslast[0];

//}    

 

require_once 'anet_php_sdk/AuthorizeNet.php';    

define("AUTHORIZENET_API_LOGIN_ID", "xxxxxxxxx");

define("AUTHORIZENET_TRANSACTION_KEY", "xxxxxxxxxx");    

$request = new AuthorizeNetCIM;    

// Create new customer profile    

$customerProfile                    = new AuthorizeNetCustomer;    

$customerProfile->description       = $first . " " . $last;    

$customerProfile->merchantCustomerId= time();    

$customerProfile->email             = $email;    

$response = $request->createCustomerProfile($customerProfile);    

if ($response->isOk()) {        

$customerProfileId = $response->getCustomerProfileId();    

}

// echo "resp=" . $response;  

echo "ID=" . $CustomerProfileID;

//$sql="update applicants set profileid='" . $CustomProfileID . "' where id=" . $id;

//mysql_query($sql);

?>

 

takabyte
Contributor
10 REPLIES 10

There is also CIM php sample code

Maybe you can use that.