Suddenly we start getting “TCP connection reset by peer” response from “Salesforce” after sending lead information using web services.
Technical Stack used at our end:
OS: Redhat Linux (RHEL)
Web Server: APACHE
Web Scripting Language: PHP
Used CURL for sending the details.
Code snippet for sending lead generation requested to Salesforce is ….
/*****************************************************************************************************/
/* Purpose : Sending request to sales-force for lead generation
/* Inputs : $pStrPostArr :: Post data array.
/* Returns : None.
/* Created By : Jaiswar Vipin Kumar R.
/*****************************************************************************************************/
function send($pStrPostArr = array()){
/* if post data is empty then do needful */
if (empty($pStrPostArr)){
/* return status */
return false;
}
/* set POST variables */
$strDestiantionURL = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
/* removed used index */
unset($pStrPostArr['desitnationURL']);
/* if destination URL is not set then do needful */
if (empty($strDestiantionURL)){
/* return status */
return false;
}
/* variable initialization */
$strFields = '';
/* url-ify the data for the POST */
foreach($pStrPostArr as $strKey=>$strValue) {
if($strFields == ''){
$strFields .= $strKey.'='.$strValue;
}else{
$strFields .= '&'.$strKey.'='.$strValue;
}
}
// rtrim($strFields,'&');
if(isset($_COOKIE['debug'])){
//print_r($pStrPostArr);
echo $strFields;exit;
}
/* open connection */
$ch = curl_init($strDestiantionURL);
/* set the url, number of POST vars, POST data */
curl_setopt($ch,CURLOPT_URL,$strDestiantionURL);
curl_setopt($ch,CURLOPT_POST,count($pStrPostArr));
curl_setopt($ch,CURLOPT_POSTFIELDS,$strFields);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
/* execute post */
$this->_strReponse = curl_exec($ch);
/* Request Body */
$this->_strRequestBody = curl_getinfo($ch);
if($this->_strReponse === FALSE){
$this->_strError = curl_error($ch);
}
/* close connection */
curl_close($ch);
}
And Send Lead Information DataSet is :
Array
(
[desitnationURL] => https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8
[first_name] => Jaiswar
[last_name] => Vipin+Kumar+R
[company] => PocketApp
[job_title__c] =>
[country_c__c] =>
[appdetail] => app development & designing
[email] => vipin.jaiswar%40pocketapp.co.uk
[phone] => %2B919773596947
[Lead_Budget__c] => Undisclosed
[description] => Fill+out+the+form+below+with+your+requirments+and+we+will+get+back+to+you+as+soon+as+possible.+Alternatively%2C+send+an+email+to+sales%40pocketapp.co.uk+or+give+us+a+call+on+%2B44+20+7183+4388
[oid] => XXXXXXXXXXXXXXX
[sfga] => XXXXXXXXXXXXXXX
[retURL] => https://www.pocketapp.co.uk/thank-you/
[lead_source] => Web
[source__c] => https://www.semrush.com/siteaudit/campaign/472189/review/
[medium__c] => -
[campaign__c] => -
[term__c] => -
[content__c] =>
[Visitor_ID__c] => -
[gclid__c] => -
[Count_of_Sessions__c] => 1
[Count_of_Pageviews__c] => 1
[00ND0000006RIpG] =>
[00ND0000006RHJY] =>
[00ND0000006RHJd] =>
[00ND0000006RHJi] =>
[00ND0000006RHJs] =>
[00ND0000006RHJn] =>
[00ND00000064Guy] =>
[00ND00000064Gv3] =>
)
Can you please assist us, what changes we need to make our end to make this start working as it was?
Salesforce moved the web2lead endpoint, you need to change your destination URL to use webto.salesforce.com instead of www.salesforce.com
see this KB article.
Related
my sugarcrm site local on a linux ubantu site , and I write some PHP files make rest call to this site , these PHP files on azure cloud.
I find even for a simple rest call , sometimes it will return correct result , but sometimes it return "Invalid session" , just like below :
Array ( [name] => Invalid Session ID [number] => 11 [description] => The session ID is invalid )
I mean when I refresh the request php constently , what it return is not certain . If I locate these PHP file in my local machine , not azure , then no matter how many request I test , all will get correct result.
my rest request 's sequence is :
first login with admin username and pwd like below :
$url = "http://crm.abc.xyz/service/v4_1/rest.php";
ini_set('max_execution_time', 300);
function restRequest($method, $arguments){
global $url;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$post = array(
"method" => $method,
"input_type" => "JSON",
"response_type" => "JSON",
"rest_data" => json_encode($arguments),
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($curl);
curl_close($curl);
return json_decode($result,1);
}
$carrierID = '9';
$userAuth = array(
'user_name' => 'admin',
'password' => md5('XXXXXXX'),
);
$appName = 'My SuiteCRM REST Client';
$nameValueList = array();
$args = array(
'user_auth' => $userAuth,
'application_name' => $appName,
'name_value_list' => $nameValueList);
$result = restRequest('login',$args);
$sessId = $result['id'];
once get return session id into variable $sessId , use this session to make other rest call :
$entryArgs = array(
'session' => $sessId,
'module_name' => 'Accounts',
'query' => "carrierid_c ='999'",
'max_results' => 2,
'deleted' => 0,
);
$result = restRequest('get_entry_list',$entryArgs);
print_r($result);
when print_r($result); sometimes it display :
Array ( [result_count] => 0 [total_count] => 0 [next_offset] => 0 [entry_list] => Array ( ) [relationship_list] => Array ( ) )
mean no this account , this is correct ,
but somethimes it display :
Array ( [name] => Invalid Session ID [number] => 11 [description] => The session ID is invalid )
My guess is when the request send to ubantu site from azure , it maybe from different instance , so sugarcrm at ubantu recv same user 's request from different IP and think it is fake session , I do not know if this guess is correct , also do not know how to fix it in azure , appreciate for your help .
I have find the answer , azure do send request to sugarcrm var different IP , to avoid "invalid session " , I need uncheck "validate client IP" in system setting ----> advance
I'm trying to use Paypal Mass Payment API with this code, but I got this error.
I saved this code to a file 'MassPay.php' and uploaded it to my localhost. I'm trying to test the code and if I can make it work I'll use it inside core php, to monthly mass pay teachers.
Array
(
[TIMESTAMP] => 2015-07-03T06:55:19Z
[CORRELATIONID] => 437cfd2eedc02
[ACK] => Failure
[VERSION] => 74.0
[BUILD] => 17235934
[L_ERRORCODE0] => 10004
[L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
[L_LONGMESSAGE0] => The number of input records is less than or equal to zero
[L_SEVERITYCODE0] => Error
[ERRORS] => Array
(
[0] => Array
(
[L_ERRORCODE] => 10004
[L_SHORTMESSAGE] => Transaction refused because of an invalid argument. See additional error messages for details.
[L_LONGMESSAGE] => The number of input records is less than or equal to zero
[L_SEVERITYCODE] => Error
)
)
[REQUESTDATA] => Array
(
[USER] => dudhat-facilitator_api1.artoongames.com
[PWD] => AXAT8HSZRR4XANFZ
[VERSION] => 74.0
[BUTTONSOURCE] => AngellEYE_PHPClass
[SIGNATURE] => AFcWxV21C7fd0v3bYYYRCpSSRl31Ab1QV5bWA6uEZ.6emUAkZaZEhjiA
[METHOD] => MassPay
[EMAILSUBJECT] => dudhat#artoongames.com
[CURRENCYCODE] => USD
[RECEIVERTYPE] => EmailAddress
)
[RAWREQUEST] => USER=dudhat-facilitator_api1.artoongames.com&PWD=AXAT8HSZRR4XANFZ&VERSION=74.0&BUTTONSOURCE=AngellEYE_PHPClass&SIGNATURE=AFcWxV21C7fd0v3bYYYRCpSSRl31Ab1QV5bWA6uEZ.6emUAkZaZEhjiA&METHOD=MassPay&EMAILSUBJECT=dudhat%40artoongames.com&CURRENCYCODE=USD&RECEIVERTYPE=EmailAddress
[RAWRESPONSE] => TIMESTAMP=2015%2d07%2d03T06%3a55%3a19Z&CORRELATIONID=437cfd2eedc02&ACK=Failure&VERSION=74%2e0&BUILD=17235934&L_ERRORCODE0=10004&L_SHORTMESSAGE0=Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e&L_LONGMESSAGE0=The%20number%20of%20input%20records%20is%20less%20than%20or%20equal%20to%20zero&L_SEVERITYCODE0=Error
)
Use this code "MassPay.php"
<?php
// Include required library files.
require_once('includes/config.php');
require_once('includes/paypal.class.php');
// Create PayPal object.
$PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature);
$PayPal = new PayPal($PayPalConfig);
// Prepare request arrays
$MPFields = array(
'emailsubject' => 'dudhat#artoongames.com', // The subject line of the email that PayPal sends when the transaction is completed. Same for all recipients. 255 char max.
'currencycode' => 'USD', // Three-letter currency code.
'receivertype' => 'EmailAddress' // Indicates how you identify the recipients of payments in this call to MassPay. Must be EmailAddress or UserID
);
// Typically, you'll loop through some sort of records to build your MPItems array.
// Here I simply include 3 items individually.
$Item1 = array(
'l_email' => 'dudhat#gmail.com', // Required. Email address of recipient. You must specify either L_EMAIL or L_RECEIVERID but you must not mix the two.
'l_receiverid' => 'dudhat#gmail.com', // Required. ReceiverID of recipient. Must specify this or email address, but not both.
'l_amt' => '10.00', // Required. Payment amount.
'l_uniqueid' => '522', // Transaction-specific ID number for tracking in an accounting system.
'l_note' => 'test payment' // Custom note for each recipient.
);
$Item2 = array(
'l_email' => 'dilip#gmail.com', // Required. Email address of recipient. You must specify either L_EMAIL or L_RECEIVERID but you must not mix the two.
'l_receiverid' => 'dilip#gmail.com', // Required. ReceiverID of recipient. Must specify this or email address, but not both.
'l_amt' => '1.00', // Required. Payment amount.
'l_uniqueid' => '523', // Transaction-specific ID number for tracking in an accounting system.
'l_note' => 'test payment' // Custom note for each recipient.
);
$MPItems = array($Item1,$Item2); // etc
$PayPalRequestData = array('MPFields' => $MPFields, 'MPItems' => $MPFields);
// Pass data into class for processing with PayPal and load the response array into $PayPalResult
$PayPalResult = $PayPal->MassPay($PayPalRequestData);
// Write the contents of the response array to the screen for demo purposes.
echo '<pre />';
print_r($PayPalResult);
?>
You assembled some payment items in $MPItems, but did not add $MPItems into the PayPal request data. So PayPal rejected the mass payment as containing no payment items.
You can use below class for to make transaction of mass pay
define your constants with actual your credentials of paypal with mode(live/sandbox).
class PaypalnvpComponent {
private static $API_Username = PAYPAL_API_USERNAME;
private static $API_Password = PAYPAL_API_PASSWORD;
private static $API_Signature = PAYPAL_API_SIGNATURE;
private static $API_Environment = PAYPAL_API_MODE;
private static $API_Version = '116.0';
public static function Call($methodName,$params){
if(self::$API_Environment == 'LIVE'){
$API_Endpoint = "https://api-3t.paypal.com/nvp";
}else{
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
}
$nvpstr = "";
foreach($params as $k=>$v){
$nvpstr .="&".$k."=".urlencode($v);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
//Turn of server and pakagemanager
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
//set the API operation,version,API signature in requrest
$nvpreq ="";
$nvpreq .= "METHOD=".urlencode($methodName);
$nvpreq .= "&VERSION=".urlencode(self::$API_Version);
$nvpreq .= "&PWD=".urlencode(self::$API_Password);
$nvpreq .= "&USER=".urlencode(self::$API_Username);
$nvpreq .= "&SIGNATURE=".urlencode(self::$API_Signature);
$nvpreq .= $nvpstr;
//set the request as POST field for curl
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
//get the response from server
$httpResponse = curl_exec($ch);
if(!$httpResponse){
return "$methodName failed:".curl_error($ch).'('.curl_errno($ch).')';
}
//Extract the response details
$httpResponseArray = explode('&', $httpResponse);
$httpParsedResponseArray = array();
foreach ($httpResponseArray as $i=>$value){
$tmpArray = explode('=', $value);
if(sizeof($tmpArray) > 1){
$httpParsedResponseArray[$tmpArray[0]] = urldecode($tmpArray[1]);
}
}
if((0 == sizeof($httpParsedResponseArray)) || !array_key_exists('ACK',$httpParsedResponseArray)){
return "Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.";
}
return $httpParsedResponseArray;
}
#----------------------------
# #$hok
# mass payment with multiple users in one go
# paypal transaction status will be : Completed, Failed, Returned, Reversed, Unclaimed, Pending, Blocked
#----------------------------
public static function MassPay($params){
$methodName = "MassPay";
return self::Call($methodName, $params);
}
public static function GetTransactionDetail($params){
$methodName = "GetTransactionDetails";
return self::Call($methodName, $params);
}
public static function TransactionSearch($params){
$methodName = "TransactionSearch";
return self::Call($methodName, $params);
}
}
# below is the example how to use above class
$params = array();
$params["RECEIVERTYPE"] = "EmailAddress";
$params["EMAILSUBJECT"] = "Your withdraw request was processed";
$params["L_AMT0"] = 1;
$params["L_EMAIL0"] = "xyz#xyz.abc";
$params["L_UNIQUEID0"] = rand(11111,9999999);
$params["L_AMT1"] = 2;
$params["L_EMAIL1"] = "hamed-buyer#lifeofu.com";
$params["L_UNIQUEID1"] = rand(11111,9999999);
$params["L_AMT2"] = 3;
$params["L_EMAIL2"] = "testuser1#test1.com";
$params["L_UNIQUEID2"] = rand(11111,9999999);
$params["CURRENCYCODE"] = "USD";
$result = PaypalnvpComponent::MassPay($params);
//transaction detial
$params = array();
$params["TRANSACTIONID"] = TRANSACTIONID_HERE;
$result = PaypalnvpComponent::GetTransactionDetail($params);
I have a multilingual site with an 'index.php' sitting on example.com domain. This index.php should have this redirection code so when users go to 'example.com' they get redirected to either the French or English version of the site.
In its simplest form I'd like the conditional statement to read:
If IP is based in France redirect to example.com/fr else if anywhere else in the world redirect to example.com/en
How might I set this up using PHP?
Have a look at http://www.geoplugin.com/webservices/php and use a cache to store the IP address as not to make the request every time.
<?php
error_reporting(-1);
ini_set("display_errors", "On");
$ch = curl_init('http://www.geoplugin.net/php.gp?ip={the IP address, used mine for example}');
if (!$ch) {
die('Failed CURL');
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$serverResponse = curl_exec($ch);
if (!$serverResponse) {
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
throw new Exception('HTTP error: ' . $code);
}
die(print_r($serverResponse));
Will result in:
Array
(
[geoplugin_request] => My IP
[geoplugin_status] => 206
[geoplugin_credit] => Some of the returned data includes GeoLite data created by MaxMind, available from <a href=\'http://www.maxmind.com\'>http://www.maxmind.com</a>.
[geoplugin_city] =>
[geoplugin_region] =>
[geoplugin_areaCode] => 0
[geoplugin_dmaCode] => 0
[geoplugin_countryCode] => GB
[geoplugin_countryName] => United Kingdom
[geoplugin_continentCode] => EU
[geoplugin_latitude] => 51.5
[geoplugin_longitude] => -0.13
[geoplugin_regionCode] =>
[geoplugin_regionName] =>
[geoplugin_currencyCode] => GBP
[geoplugin_currencySymbol] => £
[geoplugin_currencySymbol_UTF8] => £
[geoplugin_currencyConverter] => 0.6003
)
So use the country code.
The specific 401 error message I get is:
"error":"invalid_client","error_description":"The client credentials are invalid"}"
This error isn't listed anywhere in the PayPal documentation. I am certain I am using the test credentials and using the correct sandbox endpoint. The error occurs when I attempt to get an access token.
This is the class where the access token is retrieved:
private function _generateAccessToken($config) {
$base64ClientID = base64_encode($this->clientId . ":" . $this->clientSecret);
$headers = array(
"User-Agent" => PPUserAgent::getValue(RestHandler::$sdkName, RestHandler::$sdkVersion),
"Authorization" => "Basic " . $base64ClientID,
"Accept" => "*/*"
);
$httpConfiguration = $this->getOAuthHttpConfiguration($config);
$httpConfiguration->setHeaders($headers);
$connection = PPConnectionManager::getInstance()->getConnection($httpConfiguration, $config);
//print_r($connection); die;
$res = $connection->execute("grant_type=client_credentials");
$jsonResponse = json_decode($res, true);
if($jsonResponse == NULL ||
!isset($jsonResponse["access_token"]) || !isset($jsonResponse["expires_in"]) ) {
$this->accessToken = NULL;
$this->tokenExpiresIn = NULL;
$this->logger->warning("Could not generate new Access token. Invalid response from server: " . $jsonResponse);
} else {
$this->accessToken = $jsonResponse["access_token"];
$this->tokenExpiresIn = $jsonResponse["expires_in"];
}
$this->tokenCreateTime = time();
return $this->accessToken;
}
This is the $connection variable I have when I print_r (I removed the authorization string):
PayPal\Core\PPHttpConnection Object( [httpConfig:PayPal\Core\PPHttpConnection:private] => PayPal\Core\PPHttpConfig Object ( [headers:PayPal\Core\PPHttpConfig:private] => Array ( [User- Agent] => PayPalSDK/rest-sdk-php 0.6.0 (lang=PHP;v=5.4.21;bit=64;os=Linux_2.6.18- 308.16.1.el5;machine=x86_64;openssl=0.9.8e-fips-rhel5;curl=7.24.0) [Authorization] => Basic REMOVED AUTHORIZATION STRING == [Accept] => */* ) [curlOptions:PayPal\Core\PPHttpConfig:private] => Array ( [32] => 3 [78] => 30 [19913] => 1 [13] => 60 [10018] => PayPal-PHP-SDK [10023] => Array ( ) [81] => 2 [64] => 1 ) [url:PayPal\Core\PPHttpConfig:private] => https://api.sandbox.paypal.com/v1/oauth2/token [method:PayPal\Core\PPHttpConfig:private] => POST [retryCount:PayPal\Core\PPHttpConfig:private] => 1 ) [logger:PayPal\Core\PPHttpConnection:private] => PayPal\Core\PPLoggingManager Object ( [loggerName:PayPal\Core\PPLoggingManager:private] => PayPal\Core\PPHttpConnection [isLoggingEnabled:PayPal\Core\PPLoggingManager:private] => 1 [loggingLevel:PayPal\Core\PPLoggingManager:private] => 3 [loggerFile:PayPal\Core\PPLoggingManager:private] => PayPal.log ))
As far I can tell, I have correct credentials, correct endpoint, not sure what else it could be?
A HTTP401 on /token is returned if the client_id/secret aren’t recognized (either the wrong credentials for the environment, or the credentials aren’t active).
Can you run a test via cURL to rule out any environment / code-specific issues?
curl -v -u "client_id:secret" "https://api.sandbox.paypal.com/v1/oauth2/token" -X POST -d "response_type=token&grant_type=client_credentials"
(Replace client_id and secret above with your own)
Make sure payment $config mode is Sandbox and clientId and clientSecret keys are Sandbox same time.
i am using the authorize.net as my payment gateway which accept payment from credit card
the code is as follows
$ex=JRequest::getVar('exp2','');
$amount1=JRequest::getVar('amounttrue','');
if($amount1!="")
{
//echo"dsfgdsf";
$amount=$amount1;
//echo $amount;die;
}//echo $amount;die;
$post_url = "https://test.authorize.net/gateway/transact.dll";
$amount =$_POST['amount'];
$amount =$_POST['amounttrue'];
$card_num=$_POST['ccn'];
$first_name=$_POST['firstname'];
$last_name=$_POST['lastname'];
$address1=$_POST['address1'];
$state=$_POST['state'];
$zipcode=$_POST['zipcode'];
$ccname=$_POST['ccname'];
$db=&JFactory::getDBO();
$query="select * from #__book_gateway where id=1";
$db->setQuery($query);
$result=$db->loadObjectlist();
//print_r($result);die;
foreach($result as $info)
{ $login=$info->api_user_name;
$pass=$info->api_password;//die;
}//print_r($login);die;
$post_values = array(
// the API Login ID and Transaction Key must be replaced with valid values
"x_login" => "$login",
"x_tran_key" => "$pass",
//"x_login" => "52y88ZGH9f9",
//"x_tran_key" => "5rG9j97Ce46xAZzY",
/*"x_login" => "52y88ZGH9f1",
"x_tran_key" => "5rG9j97Ce46xAZzY",*/
"x_version" => "3.1",
"x_delim_data" => "TRUE",
"x_delim_char" => "|",
"x_relay_response" => "FALSE",
"x_type" => "AUTH_CAPTURE",
"x_method" => "CC",
//"x_card_num" => "4111111111111111",
"x_card_num" => "$card_num",
//"x_exp_date" => "0115",
"x_exp_date" => "$ex",
"x_amount" =>" $amount",
//"x_amount" => "19.99",
//"x_description" => "Sample Transaction",
"x_description" =>"$ccname",
//"x_first_name" => "John",
"x_first_name" =>"$first_name",
//"x_last_name" => "Doe",
"x_last_name" => "$last_name",
//"x_address" => "1234 Street",
"x_address" => "$address1",
//"x_state" => "WA",
"x_state" =>"$state",
//"x_zip" => "98004"
"x_zip" => "$zipcode"
//"x_market_type" => "2",
// "x_cpversion" => "1.0",
// "x_device_type"=>"7"
// Additional fields can be added here as outlined in the AIM integration
// guide at: http://developer.authorize.net
);
// This section takes the input fields and converts them to the proper format
// for an http post. For example: "x_login=username&x_tran_key=a1B2c3D4"
$post_string = "";
foreach( $post_values as $key => $value )
{ $post_string .= "$key=" . urlencode( $value ) . "&"; }
$post_string = rtrim( $post_string, "& " );
// The following section provides an example of how to add line item details to
// the post string. Because line items may consist of multiple values with the
// same key/name, they cannot be simply added into the above array.
//
// This section is commented out by default.
/*
$line_items = array(
"item1<|>golf balls<|><|>2<|>18.95<|>Y",
"item2<|>golf bag<|>Wilson golf carry bag, red<|>1<|>39.99<|>Y",
"item3<|>book<|>Golf for Dummies<|>1<|>21.99<|>Y");
foreach( $line_items as $value )
{ $post_string .= "&x_line_item=" . urlencode( $value ); }
*/
// This sample code uses the CURL library for php to establish a connection,
// submit the post, and record the response.
// If you receive an error, you may want to ensure that you have the curl
// library enabled in your php configuration
$request = curl_init($post_url); // initiate curl object
curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.
$post_response = curl_exec($request); // execute curl post and store results in $post_response
//print_r($post_response); die;
// additional options may be required depending upon your server configuration
// you can find documentation on curl options at http://www.php.net/curl_setopt
curl_close ($request); // close curl object
$response_array = explode($post_values["x_delim_char"],$post_response);
print_r($response_array);die;
But the above code is giving the error "Can not accept payment from this market type".I have browse the net but not getting the solution.
What type of authorize.net account have you signed up for ? Retail or ECom ?
Retail accounts require card to be present during transaction
You are seeing this error because you accidentally signed up for a retail account instead of a card not present account. To fix this either sign up again for a card not present account or contact Authnet to have them change your account type for you.