<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic sample.php question in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/sample-php-question/m-p/38065#M20846</link>
    <description>&lt;P&gt;I'm new to Authorize.net.&amp;nbsp; I've looked at the two AIM examples I could find (The coffee store example and the sample.php example -- which I posted below)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that the sample.php works fine but it does not seem to reference the SDK AuthorizeNet.php.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some reason that one would need to use AuthorizeNet.php for AIM?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see it in the Coffee store example, but not sample.php.&amp;nbsp; (Also, Are there any other examples available?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sample.php . . .&lt;/P&gt;&lt;P&gt;&amp;lt;!--&lt;BR /&gt;This sample code is designed to connect to Authorize.net using the AIM method.&lt;BR /&gt;For API documentation or additional sample code, please visit:&lt;BR /&gt;&lt;A href="http://developer.authorize.net" target="_blank"&gt;http://developer.authorize.net&lt;/A&gt;&lt;BR /&gt;--&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&lt;BR /&gt;&amp;nbsp; "&lt;A href="https://community.developer.cybersource.com/" target="_blank"&gt;http://www.w3.org/TR/html4/loose.dtd"&amp;gt;&lt;/A&gt;&lt;BR /&gt;&amp;lt;HTML lang='en'&amp;gt;&lt;BR /&gt;&amp;lt;HEAD&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;TITLE&amp;gt; Sample AIM Implementation &amp;lt;/TITLE&amp;gt;&lt;BR /&gt;&amp;lt;/HEAD&amp;gt;&lt;BR /&gt;&amp;lt;BODY&amp;gt;&lt;BR /&gt;&amp;lt;P&amp;gt; This sample code is designed to generate a post using Authorize.net's&lt;BR /&gt;Advanced Integration Method (AIM) and display the results of this post to&lt;BR /&gt;the screen. &amp;lt;/P&amp;gt;&lt;BR /&gt;&amp;lt;P&amp;gt; For details on how this is accomplished, please review the readme file,&lt;BR /&gt;the comments in the sample code, and the Authorize.net AIM API documentation&lt;BR /&gt;found at &lt;A href="http://developer.authorize.net" target="_blank"&gt;http://developer.authorize.net&lt;/A&gt; &amp;lt;/P&amp;gt;&lt;BR /&gt;&amp;lt;HR /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;?PHP&lt;BR /&gt;&lt;BR /&gt;// By default, this sample code is designed to post to our test server for&lt;BR /&gt;// developer accounts: &lt;A href="https://test.authorize.net/gateway/transact.dll" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll&lt;/A&gt;&lt;BR /&gt;// for real accounts (even in test mode), please make sure that you are&lt;BR /&gt;// posting to: &lt;A href="https://secure.authorize.net/gateway/transact.dll" target="_blank"&gt;https://secure.authorize.net/gateway/transact.dll&lt;/A&gt;&lt;BR /&gt;$post_url = "&lt;A href="https://test.authorize.net/gateway/transact.dll&amp;quot;;" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll";&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;$post_values = array(&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// the API Login ID and Transaction Key must be replaced with valid values&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_login"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "XXXXXX",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_tran_key"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "XXXXX",&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_version"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "3.1",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_delim_data"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "TRUE",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_delim_char"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "|",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_relay_response"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "FALSE",&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_type"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "AUTH_CAPTURE",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_method"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "CC",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_card_num"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "4111111111111111",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_exp_date"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "0115",&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_amount"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "22.99",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_description"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "Sample Transaction",&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_first_name"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "John",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_last_name"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "Doe",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_address"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "1234 Street",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_state"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "WA",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_zip"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "98004"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Additional fields can be added here as outlined in the AIM integration&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// guide at: &lt;A href="http://developer.authorize.net" target="_blank"&gt;http://developer.authorize.net&lt;/A&gt;&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;// This section takes the input fields and converts them to the proper format&lt;BR /&gt;// for an http post.&amp;nbsp; For example: "x_login=username&amp;amp;x_tran_key=a1B2c3D4"&lt;BR /&gt;$post_string = "";&lt;BR /&gt;foreach( $post_values as $key =&amp;gt; $value )&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ $post_string .= "$key=" . urlencode( $value ) . "&amp;amp;"; }&lt;BR /&gt;$post_string = rtrim( $post_string, "&amp;amp; " );&lt;BR /&gt;&lt;BR /&gt;// The following section provides an example of how to add line item details to&lt;BR /&gt;// the post string.&amp;nbsp; Because line items may consist of multiple values with the&lt;BR /&gt;// same key/name, they cannot be simply added into the above array.&lt;BR /&gt;//&lt;BR /&gt;// This section is commented out by default.&lt;BR /&gt;/*&lt;BR /&gt;$line_items = array(&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"item1&amp;lt;|&amp;gt;golf balls&amp;lt;|&amp;gt;&amp;lt;|&amp;gt;2&amp;lt;|&amp;gt;18.95&amp;lt;|&amp;gt;Y",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"item2&amp;lt;|&amp;gt;golf bag&amp;lt;|&amp;gt;Wilson golf carry bag, red&amp;lt;|&amp;gt;1&amp;lt;|&amp;gt;39.99&amp;lt;|&amp;gt;Y",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"item3&amp;lt;|&amp;gt;book&amp;lt;|&amp;gt;Golf for Dummies&amp;lt;|&amp;gt;1&amp;lt;|&amp;gt;21.99&amp;lt;|&amp;gt;Y");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;foreach( $line_items as $value )&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ $post_string .= "&amp;amp;x_line_item=" . urlencode( $value ); }&lt;BR /&gt;*/&lt;BR /&gt;&lt;BR /&gt;// This sample code uses the CURL library for php to establish a connection,&lt;BR /&gt;// submit the post, and record the response.&lt;BR /&gt;// If you receive an error, you may want to ensure that you have the curl&lt;BR /&gt;// library enabled in your php configuration&lt;BR /&gt;$request = curl_init($post_url); // initiate curl object&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$post_response = curl_exec($request); // execute curl post and store results in $post_response&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// additional options may be required depending upon your server configuration&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// you can find documentation on curl options at &lt;A href="http://www.php.net/curl_setopt" target="_blank"&gt;http://www.php.net/curl_setopt&lt;/A&gt;&lt;BR /&gt;curl_close ($request); // close curl object&lt;BR /&gt;&lt;BR /&gt;// This line takes the response and breaks it into an array using the specified delimiting character&lt;BR /&gt;$response_array = explode($post_values["x_delim_char"],$post_response);&lt;BR /&gt;&lt;BR /&gt;// The results are output to the screen in the form of an html numbered list.&lt;BR /&gt;echo "&amp;lt;OL&amp;gt;\n";&lt;BR /&gt;foreach ($response_array as $value)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo "&amp;lt;LI&amp;gt;" . $value . "&amp;amp;nbsp;&amp;lt;/LI&amp;gt;\n";&lt;BR /&gt;}&lt;BR /&gt;echo "&amp;lt;/OL&amp;gt;\n";&lt;BR /&gt;// individual elements of the array could be accessed to read certain response&lt;BR /&gt;// fields.&amp;nbsp; For example, response_array[0] would return the Response Code,&lt;BR /&gt;// response_array[2] would return the Response Reason Code.&lt;BR /&gt;// for a list of response fields, please review the AIM Implementation Guide&lt;BR /&gt;?&amp;gt;&lt;BR /&gt;&amp;lt;/BODY&amp;gt;&lt;BR /&gt;&amp;lt;/HTML&amp;gt;&lt;/P&gt;</description>
    <pubDate>Sat, 28 Dec 2013 20:58:45 GMT</pubDate>
    <dc:creator>jthomas006</dc:creator>
    <dc:date>2013-12-28T20:58:45Z</dc:date>
    <item>
      <title>sample.php question</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/sample-php-question/m-p/38065#M20846</link>
      <description>&lt;P&gt;I'm new to Authorize.net.&amp;nbsp; I've looked at the two AIM examples I could find (The coffee store example and the sample.php example -- which I posted below)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that the sample.php works fine but it does not seem to reference the SDK AuthorizeNet.php.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some reason that one would need to use AuthorizeNet.php for AIM?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see it in the Coffee store example, but not sample.php.&amp;nbsp; (Also, Are there any other examples available?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sample.php . . .&lt;/P&gt;&lt;P&gt;&amp;lt;!--&lt;BR /&gt;This sample code is designed to connect to Authorize.net using the AIM method.&lt;BR /&gt;For API documentation or additional sample code, please visit:&lt;BR /&gt;&lt;A href="http://developer.authorize.net" target="_blank"&gt;http://developer.authorize.net&lt;/A&gt;&lt;BR /&gt;--&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&lt;BR /&gt;&amp;nbsp; "&lt;A href="https://community.developer.cybersource.com/" target="_blank"&gt;http://www.w3.org/TR/html4/loose.dtd"&amp;gt;&lt;/A&gt;&lt;BR /&gt;&amp;lt;HTML lang='en'&amp;gt;&lt;BR /&gt;&amp;lt;HEAD&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;lt;TITLE&amp;gt; Sample AIM Implementation &amp;lt;/TITLE&amp;gt;&lt;BR /&gt;&amp;lt;/HEAD&amp;gt;&lt;BR /&gt;&amp;lt;BODY&amp;gt;&lt;BR /&gt;&amp;lt;P&amp;gt; This sample code is designed to generate a post using Authorize.net's&lt;BR /&gt;Advanced Integration Method (AIM) and display the results of this post to&lt;BR /&gt;the screen. &amp;lt;/P&amp;gt;&lt;BR /&gt;&amp;lt;P&amp;gt; For details on how this is accomplished, please review the readme file,&lt;BR /&gt;the comments in the sample code, and the Authorize.net AIM API documentation&lt;BR /&gt;found at &lt;A href="http://developer.authorize.net" target="_blank"&gt;http://developer.authorize.net&lt;/A&gt; &amp;lt;/P&amp;gt;&lt;BR /&gt;&amp;lt;HR /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;?PHP&lt;BR /&gt;&lt;BR /&gt;// By default, this sample code is designed to post to our test server for&lt;BR /&gt;// developer accounts: &lt;A href="https://test.authorize.net/gateway/transact.dll" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll&lt;/A&gt;&lt;BR /&gt;// for real accounts (even in test mode), please make sure that you are&lt;BR /&gt;// posting to: &lt;A href="https://secure.authorize.net/gateway/transact.dll" target="_blank"&gt;https://secure.authorize.net/gateway/transact.dll&lt;/A&gt;&lt;BR /&gt;$post_url = "&lt;A href="https://test.authorize.net/gateway/transact.dll&amp;quot;;" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll";&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;$post_values = array(&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// the API Login ID and Transaction Key must be replaced with valid values&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_login"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "XXXXXX",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_tran_key"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "XXXXX",&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_version"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "3.1",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_delim_data"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "TRUE",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_delim_char"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "|",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_relay_response"&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "FALSE",&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_type"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "AUTH_CAPTURE",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_method"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "CC",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_card_num"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "4111111111111111",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_exp_date"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "0115",&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_amount"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "22.99",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_description"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "Sample Transaction",&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_first_name"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "John",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_last_name"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "Doe",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_address"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "1234 Street",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_state"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "WA",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"x_zip"&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt; "98004"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Additional fields can be added here as outlined in the AIM integration&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// guide at: &lt;A href="http://developer.authorize.net" target="_blank"&gt;http://developer.authorize.net&lt;/A&gt;&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;// This section takes the input fields and converts them to the proper format&lt;BR /&gt;// for an http post.&amp;nbsp; For example: "x_login=username&amp;amp;x_tran_key=a1B2c3D4"&lt;BR /&gt;$post_string = "";&lt;BR /&gt;foreach( $post_values as $key =&amp;gt; $value )&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ $post_string .= "$key=" . urlencode( $value ) . "&amp;amp;"; }&lt;BR /&gt;$post_string = rtrim( $post_string, "&amp;amp; " );&lt;BR /&gt;&lt;BR /&gt;// The following section provides an example of how to add line item details to&lt;BR /&gt;// the post string.&amp;nbsp; Because line items may consist of multiple values with the&lt;BR /&gt;// same key/name, they cannot be simply added into the above array.&lt;BR /&gt;//&lt;BR /&gt;// This section is commented out by default.&lt;BR /&gt;/*&lt;BR /&gt;$line_items = array(&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"item1&amp;lt;|&amp;gt;golf balls&amp;lt;|&amp;gt;&amp;lt;|&amp;gt;2&amp;lt;|&amp;gt;18.95&amp;lt;|&amp;gt;Y",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"item2&amp;lt;|&amp;gt;golf bag&amp;lt;|&amp;gt;Wilson golf carry bag, red&amp;lt;|&amp;gt;1&amp;lt;|&amp;gt;39.99&amp;lt;|&amp;gt;Y",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"item3&amp;lt;|&amp;gt;book&amp;lt;|&amp;gt;Golf for Dummies&amp;lt;|&amp;gt;1&amp;lt;|&amp;gt;21.99&amp;lt;|&amp;gt;Y");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;foreach( $line_items as $value )&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ $post_string .= "&amp;amp;x_line_item=" . urlencode( $value ); }&lt;BR /&gt;*/&lt;BR /&gt;&lt;BR /&gt;// This sample code uses the CURL library for php to establish a connection,&lt;BR /&gt;// submit the post, and record the response.&lt;BR /&gt;// If you receive an error, you may want to ensure that you have the curl&lt;BR /&gt;// library enabled in your php configuration&lt;BR /&gt;$request = curl_init($post_url); // initiate curl object&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$post_response = curl_exec($request); // execute curl post and store results in $post_response&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// additional options may be required depending upon your server configuration&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;// you can find documentation on curl options at &lt;A href="http://www.php.net/curl_setopt" target="_blank"&gt;http://www.php.net/curl_setopt&lt;/A&gt;&lt;BR /&gt;curl_close ($request); // close curl object&lt;BR /&gt;&lt;BR /&gt;// This line takes the response and breaks it into an array using the specified delimiting character&lt;BR /&gt;$response_array = explode($post_values["x_delim_char"],$post_response);&lt;BR /&gt;&lt;BR /&gt;// The results are output to the screen in the form of an html numbered list.&lt;BR /&gt;echo "&amp;lt;OL&amp;gt;\n";&lt;BR /&gt;foreach ($response_array as $value)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo "&amp;lt;LI&amp;gt;" . $value . "&amp;amp;nbsp;&amp;lt;/LI&amp;gt;\n";&lt;BR /&gt;}&lt;BR /&gt;echo "&amp;lt;/OL&amp;gt;\n";&lt;BR /&gt;// individual elements of the array could be accessed to read certain response&lt;BR /&gt;// fields.&amp;nbsp; For example, response_array[0] would return the Response Code,&lt;BR /&gt;// response_array[2] would return the Response Reason Code.&lt;BR /&gt;// for a list of response fields, please review the AIM Implementation Guide&lt;BR /&gt;?&amp;gt;&lt;BR /&gt;&amp;lt;/BODY&amp;gt;&lt;BR /&gt;&amp;lt;/HTML&amp;gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2013 20:58:45 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/sample-php-question/m-p/38065#M20846</guid>
      <dc:creator>jthomas006</dc:creator>
      <dc:date>2013-12-28T20:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: sample.php question</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/sample-php-question/m-p/38067#M20847</link>
      <description>&lt;P&gt;Because the sample code came out long before the SDKs and it isn't using any code from it.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2013 22:28:59 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/sample-php-question/m-p/38067#M20847</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2013-12-28T22:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: sample.php question</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/sample-php-question/m-p/38187#M20906</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/14787"&gt;@jthomas006&lt;/a&gt; wrote:&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some reason that one would need to use AuthorizeNet.php for AIM?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sample.php . . .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;No, you don't need to use the &lt;SPAN&gt;AuthorizeNetAIM&amp;nbsp;&lt;/SPAN&gt;object from&amp;nbsp;&lt;SPAN&gt;AuthorizeNet.php, but you may want to so that instead of typing all of that stuff, you can type this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
require_once 'anet_php_sdk/AuthorizeNet.php';// Make sure this path is correct.
$transaction =new AuthorizeNetAIM('YOUR_API_LOGIN_ID','YOUR_TRANSACTION_KEY');
$transaction-&amp;gt;amount ='9.99';
$transaction-&amp;gt;card_num ='4007000000027';
$transaction-&amp;gt;exp_date ='10/16';
// add other details as needed

$response = $transaction-&amp;gt;authorizeAndCapture();

if($response-&amp;gt;approved){
  echo "&amp;lt;h1&amp;gt;Success! The test credit card has been charged!&amp;lt;/h1&amp;gt;";
  echo "Transaction ID: ". $response-&amp;gt;transaction_id;
}else{
  echo $response-&amp;gt;error_message;
}
?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A href="http://developer.authorize.net/integration/fifteenminutes/#custom" target="_blank"&gt;http://developer.authorize.net/integration/fifteenminutes/#custom&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2014 20:24:46 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/sample-php-question/m-p/38187#M20906</guid>
      <dc:creator>jlanawalt</dc:creator>
      <dc:date>2014-01-06T20:24:46Z</dc:date>
    </item>
  </channel>
</rss>

