<?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 Custom PHP cURL receives NULL Response in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/54686#M29649</link>
    <description>&lt;P&gt;Hey everybody!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is probably a very simple problem, but I don't know how to fix it. &amp;nbsp;My client wants a custom report of transaction data generated with the system and I don't have access to the server to be able to load up the SDK. &amp;nbsp;I think this is going to be no problem, but for some reason all I can get back from the sandbox is "NULL."&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone please tell me what I'm doing wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
$cert_path 	= dirname(__FILE__).'/ssl/cert.pem';

$test_url 	= "https://apitest.authorize.net/xml/v1/request.api";
$prod_url 	= "https://api.authorize.net/xml/v1/request.api";
$url 		= $test_url;

$api_id 	= "MY_LOGIN_ID";
$account_key 	= "MY_TRANSACTION_ID";
$request_type 	= "getSettledBatchListRequest";

$string 	= '&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&amp;lt;'.$request_type.' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;&amp;lt;/'.$request_type.'&amp;gt;';
$xml 		= @new SimpleXMLElement($string);
$merchant 	= $xml-&amp;gt;addChild('merchantAuthentication');
$merchant-&amp;gt;addChild('name', $api_id);
$merchant-&amp;gt;addChild('transactionKey', $account_key);
$as_xml 		= $xml-&amp;gt;asXML();

$ch 		= curl_init($url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $as_xml);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 45);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if( file_exists($cert_path) ){ 
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
	curl_setopt($ch, CURLOPT_CAINFO, $cert_path); 
}
$result 	= curl_exec($ch);
echo curl_error($ch);
curl_close($ch);
$result 	= json_decode($result, true);
var_dump($result);
?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing it might be that I can't find the .xsd file in the SDK. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
    <pubDate>Fri, 20 May 2016 19:50:51 GMT</pubDate>
    <dc:creator>phpjayhawk</dc:creator>
    <dc:date>2016-05-20T19:50:51Z</dc:date>
    <item>
      <title>Custom PHP cURL receives NULL Response</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/54686#M29649</link>
      <description>&lt;P&gt;Hey everybody!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is probably a very simple problem, but I don't know how to fix it. &amp;nbsp;My client wants a custom report of transaction data generated with the system and I don't have access to the server to be able to load up the SDK. &amp;nbsp;I think this is going to be no problem, but for some reason all I can get back from the sandbox is "NULL."&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone please tell me what I'm doing wrong here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
$cert_path 	= dirname(__FILE__).'/ssl/cert.pem';

$test_url 	= "https://apitest.authorize.net/xml/v1/request.api";
$prod_url 	= "https://api.authorize.net/xml/v1/request.api";
$url 		= $test_url;

$api_id 	= "MY_LOGIN_ID";
$account_key 	= "MY_TRANSACTION_ID";
$request_type 	= "getSettledBatchListRequest";

$string 	= '&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&amp;lt;'.$request_type.' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;&amp;lt;/'.$request_type.'&amp;gt;';
$xml 		= @new SimpleXMLElement($string);
$merchant 	= $xml-&amp;gt;addChild('merchantAuthentication');
$merchant-&amp;gt;addChild('name', $api_id);
$merchant-&amp;gt;addChild('transactionKey', $account_key);
$as_xml 		= $xml-&amp;gt;asXML();

$ch 		= curl_init($url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $as_xml);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 45);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if( file_exists($cert_path) ){ 
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
	curl_setopt($ch, CURLOPT_CAINFO, $cert_path); 
}
$result 	= curl_exec($ch);
echo curl_error($ch);
curl_close($ch);
$result 	= json_decode($result, true);
var_dump($result);
?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm guessing it might be that I can't find the .xsd file in the SDK. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 19:50:51 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/54686#M29649</guid>
      <dc:creator>phpjayhawk</dc:creator>
      <dc:date>2016-05-20T19:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Custom PHP cURL receives NULL Response</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/54770#M29729</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/20111"&gt;@phpjayhawk﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It doesn't look like anyone has responded yet, but someone still may have feedback on what you're looking for. I'd recommend subscribing to this topic so that you'll be alerted via email if anyone else from the community is able to respond with any comments. To subscribe, click &lt;STRONG&gt;Topic Options&lt;/STRONG&gt; at the top of this thread and then select &lt;STRONG&gt;Subscribe&lt;/STRONG&gt;. You'll then receive an email once anyone replies to your post.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Richard&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 18:55:13 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/54770#M29729</guid>
      <dc:creator>RichardH</dc:creator>
      <dc:date>2016-05-31T18:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Custom PHP cURL receives NULL Response</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/54771#M29730</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/7546"&gt;@RichardH﻿&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will leave this up in the hopes that someone knows the answer, but I did resort to using the SDK and an answer to this issue is no longer neccesary for me.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 18:57:35 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/54771#M29730</guid>
      <dc:creator>phpjayhawk</dc:creator>
      <dc:date>2016-05-31T18:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Custom PHP cURL receives NULL Response</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/59195#M33792</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realize you&amp;nbsp;have resorted to using the SDK, but for anyone who may be interested, below is what works for this particular API call and language:&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php

$xmlContent = '&amp;lt;getSettledBatchListRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;
  &amp;lt;merchantAuthentication&amp;gt;
    &amp;lt;name&amp;gt;YOUR_API_LOGIN&amp;lt;/name&amp;gt;
    &amp;lt;transactionKey&amp;gt;YOUR_TRANSACION_KEY&amp;lt;/transactionKey&amp;gt;
  &amp;lt;/merchantAuthentication&amp;gt;
  &amp;lt;includeStatistics&amp;gt;true&amp;lt;/includeStatistics&amp;gt;
  &amp;lt;firstSettlementDate&amp;gt;2017-05-01T16:00:00Z&amp;lt;/firstSettlementDate&amp;gt;
  &amp;lt;lastSettlementDate&amp;gt;2017-05-31T16:00:00Z&amp;lt;/lastSettlementDate&amp;gt;
&amp;lt;/getSettledBatchListRequest&amp;gt;';

  $url = 'https://apitest.authorize.net/xml/v1/request.api';
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlContent);
  $result = curl_exec($ch);
  echo $result;
  curl_close($ch);&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Aug 2017 09:07:38 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-PHP-cURL-receives-NULL-Response/m-p/59195#M33792</guid>
      <dc:creator>NexusSoftware</dc:creator>
      <dc:date>2017-08-05T09:07:38Z</dc:date>
    </item>
  </channel>
</rss>

