- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
?>
04-23-2012 11:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did the insert to mysql applicants works?
Can you echo something before and after the line
$response = $request->createCustomerProfile($customerProfile);
to see if the request get process before it crashes?
Did someone regenerate the transaction key. It happen.
04-23-2012 12:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The insert did work. I put in echoes before and after the line, as requested, and both do display. And, yes, the first thing I did when it failed this morning was to create a new transaction key and put it in the program. It didn't help. And it actually doesn't crash, so long as you don't try to echo the $response variable. If you do, nothing after that will work, and it doesn't echo anything.
04-23-2012 12:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is
$response->getErrorMessage();
$response->getResultCode();
$response->getMessageCode();
$response->getMessageText();
See if you can echo those after the createCustomerProfile($customerProfile);
04-23-2012 12:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
None of them will work. I should say it fails on the first one. Last message echoed is "got here also,"
which immediately precedes $response->getErrorMessage();
04-23-2012 12:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The single idea that seems most likely to me is that the login ID and transaction key are somehow invalid. I have a set of test codes that were given to me when I signed up for a test account. I'd be happy to supply those codes to you if that would be helpful in getting to the bottom of this issue. I really need to get authorize.net working, and I can't even get off the ground.
04-23-2012 01:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you get to the https://apitest.authorize.net/xml/v1/request.api site on your browser.
Sound like it fail to connect to authorize.net.
You might need to debug the SDKs source code.
04-23-2012 01:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The earlier test was on IE. Running that same page on Chrome yields:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
04-23-2012 01:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Might be failing in _sendRequest in AuthorizeNetRequest.php
04-23-2012 02:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, how would I know? I think that if I could just get any code that uses authorize.net's CIM API to work, I would be off to the races. Do you have any other sample code that I could try, that would perhaps let me know if it wasn't getting to ANet at all?
04-23-2012 02:57 PM
