<?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 Understanding Request and Response in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Understanding-Request-and-Response/m-p/57689#M32387</link>
    <description>&lt;P&gt;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/20843"&gt;@Aaron&lt;/a&gt;&amp;nbsp;was nice enough to provide me some code to do basic Authorize &amp;amp; Capture CC processing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I have finally figured out how the XML template works, but am struggling to understand the code related to the request and response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I have so far...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Address to send Credit Card Request to Authorize.net
$url = "https://apitest.authorize.net/xml/v1/request.api";
		
try{
	$ch = curl_init();
	if ($ch === FALSE){
		throw new Exception('failed to initialize');
	}else{
		// set URL and other appropriate options
		curl_setopt($ch, CURLOPT_URL, $url);				curl_setopt($ch, CURLOPT_POST, 1);				curl_setopt($ch, CURLOPT_POSTFIELDS, $xml-&amp;gt;asXML());&lt;BR /&gt;		curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);		curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false );					
		$content = curl_exec($ch);
		$content = str_replace('xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"', '', $content);
		&lt;BR /&gt;					
		$PaymentResponse = new SimpleXMLElement($content);
&lt;BR /&gt;		if ($content === FALSE){
			throw new Exception(curl_error($ch), curl_errno($ch));
			curl_close($ch);
		}else{
			echo '$PaymentResponse = ' . $PaymentResponse;
			exit();
		}
	}

}catch(Exception $e){
	trigger_error(sprintf('Curl failed with error #%d: %s', $e-&amp;gt;getCode(), $e-&amp;gt;getMessage()), E_USER_ERROR);
}

// End script.
exit();&lt;/PRE&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;P&gt;1.) Do all of the cURL statements above just send the Request?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.) What is the purpose of these two lines?&lt;/P&gt;&lt;PRE&gt;$content = curl_exec($ch);
$content = str_replace('xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"', '', $content);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.) If the cURL statements in #1 above are just sending the Request using a POST, then why are we assigning the results of curl_exec to a variable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4.) What does this code do?&lt;/P&gt;&lt;PRE&gt;$PaymentResponse = new SimpleXMLElement($content);
if ($content === FALSE){
			throw new Exception(curl_error($ch), curl_errno($ch));
			curl_close($ch);
}else{
			echo '$PaymentResponse = ' . $PaymentResponse;
			exit();
}&lt;/PRE&gt;&lt;P&gt;Any help in helping me understand how this code works would be *greatly* appreciated so I can start using Authorize.net to make some $$$ for both of us!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sally&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Apr 2017 15:25:35 GMT</pubDate>
    <dc:creator>ssimons</dc:creator>
    <dc:date>2017-04-13T15:25:35Z</dc:date>
    <item>
      <title>Understanding Request and Response</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Understanding-Request-and-Response/m-p/57689#M32387</link>
      <description>&lt;P&gt;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/20843"&gt;@Aaron&lt;/a&gt;&amp;nbsp;was nice enough to provide me some code to do basic Authorize &amp;amp; Capture CC processing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I have finally figured out how the XML template works, but am struggling to understand the code related to the request and response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I have so far...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Address to send Credit Card Request to Authorize.net
$url = "https://apitest.authorize.net/xml/v1/request.api";
		
try{
	$ch = curl_init();
	if ($ch === FALSE){
		throw new Exception('failed to initialize');
	}else{
		// set URL and other appropriate options
		curl_setopt($ch, CURLOPT_URL, $url);				curl_setopt($ch, CURLOPT_POST, 1);				curl_setopt($ch, CURLOPT_POSTFIELDS, $xml-&amp;gt;asXML());&lt;BR /&gt;		curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);		curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false );					
		$content = curl_exec($ch);
		$content = str_replace('xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"', '', $content);
		&lt;BR /&gt;					
		$PaymentResponse = new SimpleXMLElement($content);
&lt;BR /&gt;		if ($content === FALSE){
			throw new Exception(curl_error($ch), curl_errno($ch));
			curl_close($ch);
		}else{
			echo '$PaymentResponse = ' . $PaymentResponse;
			exit();
		}
	}

}catch(Exception $e){
	trigger_error(sprintf('Curl failed with error #%d: %s', $e-&amp;gt;getCode(), $e-&amp;gt;getMessage()), E_USER_ERROR);
}

// End script.
exit();&lt;/PRE&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;P&gt;1.) Do all of the cURL statements above just send the Request?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.) What is the purpose of these two lines?&lt;/P&gt;&lt;PRE&gt;$content = curl_exec($ch);
$content = str_replace('xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"', '', $content);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.) If the cURL statements in #1 above are just sending the Request using a POST, then why are we assigning the results of curl_exec to a variable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4.) What does this code do?&lt;/P&gt;&lt;PRE&gt;$PaymentResponse = new SimpleXMLElement($content);
if ($content === FALSE){
			throw new Exception(curl_error($ch), curl_errno($ch));
			curl_close($ch);
}else{
			echo '$PaymentResponse = ' . $PaymentResponse;
			exit();
}&lt;/PRE&gt;&lt;P&gt;Any help in helping me understand how this code works would be *greatly* appreciated so I can start using Authorize.net to make some $$$ for both of us!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sally&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 15:25:35 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Understanding-Request-and-Response/m-p/57689#M32387</guid>
      <dc:creator>ssimons</dc:creator>
      <dc:date>2017-04-13T15:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding Request and Response</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Understanding-Request-and-Response/m-p/57724#M32417</link>
      <description>&lt;P&gt;These questions are more related to programming in PHP than using our API. &amp;nbsp;We suggest engaging an &lt;A href="http://www.authorize.net/cdd" target="_self"&gt;Authorize.Net Certified Develope&lt;/A&gt;r with expertise in PHP who could assist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 16:49:12 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Understanding-Request-and-Response/m-p/57724#M32417</guid>
      <dc:creator>RichardH</dc:creator>
      <dc:date>2017-04-17T16:49:12Z</dc:date>
    </item>
  </channel>
</rss>

