Aacute character remove in csv


$str = iconv(‘ISO-8859-15’, ‘UTF-8’, $emapData[1]); $search = explode(“,”,”ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u”); $replace = explode(“,”,”c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u”); $urlTitle = str_replace($search, $replace, $str);

paypal recuring method in php


index.php<?php
include "class.paypal.recurring.php";
$obj=new paypal_recurring;
$obj->environment = 'sandbox';   // or 'beta-sandbox' or 'live'
$obj->paymentType = urlencode('Authorization');          // or 'Sale' or 'Order'
// Set request-specific fields.
$obj->startDate = urlencode("2011-9-6T0:0:0");
$obj->billingPeriod = urlencode("Month");          // or "Day", "Week", "SemiMonth", "Year"
$obj->billingFreq = urlencode("4");                // combination of this and billingPeriod must be at most a year
$obj->paymentAmount = urlencode('10');
$obj->currencyID = urlencode('USD');                     // or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')
/* PAYPAL API  DETAILS */
$obj->API_UserName = urlencode('API KEY');
$obj->API_Password = urlencode('PASSWORD');
$obj->API_Signature = urlencode('SIGNATURE');
$obj->API_Endpoint = "https://api-3t.paypal.com/nvp";
/*SET SUCCESS AND FAIL URL*/
$obj->returnURL = urlencode("http://www.mysite.com/index.php?task=getExpressCheckout");
$obj->cancelURL = urlencode('http://www.mysite.comindex.php?task=error');
$task="setExpressCheckout"; //set initial task as Express Checkout
switch($task)
{
   case "setExpressCheckout":
   $obj->setExpressCheckout();
   exit;
   case "getExpressCheckout":
   $obj->getExpressCheckout();
   exit;
   case "error":
   echo "setExpress checkout failed";
   exit;
}
?>class.paypal.recurring.php

<?php
class paypal_recurring{
	

function setExpressCheckout()
{

$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;

// Add request-specific fields to the request string.
$nvpStr = "&Amt=$paymentAmount&ReturnUrl=$returnURL&CANCELURL=$cancelURL&PAYMENTACTION=$paymentType&CURRENCYCODE=$currencyID";

// Execute the API operation; see the PPHttpPost function above.
$httpParsedResponseAr = $this->fn_setExpressCheckout('SetExpressCheckout', $nvpStr);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
	// Redirect to paypal.com.
	$token = urldecode($httpParsedResponseAr["TOKEN"]);
	$payPalURL = "https://www.paypal.com/webscr&cmd=_express-checkout&token=$token";
	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$payPalURL = "https://www.$environment.paypal.com/webscr&cmd=_express-checkout&token=$token";
	}
	header("Location: $payPalURL");
	exit;
} else  {
	exit('SetExpressCheckout failed: ' . print_r($httpParsedResponseAr, true));
}



}


function getExpressCheckout()
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;
// Obtain the token from PayPal.
if(!array_key_exists('token', $_REQUEST)) {
	exit('Token is not received.');
}

// Set request-specific fields.
$token = urlencode(htmlspecialchars($_REQUEST['token']));

// Add request-specific fields to the request string.
$nvpStr = "&TOKEN=$token";

// Execute the API operation; see the PPHttpPost function above.
$httpParsedResponseAr = $this->fn_getExpressCheckout('GetExpressCheckoutDetails', $nvpStr);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
	// Extract the response details.
	$payerID = $httpParsedResponseAr['PAYERID'];
	$street1 = $httpParsedResponseAr["SHIPTOSTREET"];
	if(array_key_exists("SHIPTOSTREET2", $httpParsedResponseAr)) {
		$street2 = $httpParsedResponseAr["SHIPTOSTREET2"];
	}
	$city_name = $httpParsedResponseAr["SHIPTOCITY"];
	$state_province = $httpParsedResponseAr["SHIPTOSTATE"];
	$postal_code = $httpParsedResponseAr["SHIPTOZIP"];
	$country_code = $httpParsedResponseAr["SHIPTOCOUNTRYCODE"];


$this->doExpressCheckout($payerID,$token);

//	exit('Get Express Checkout Details Completed Successfully: '.print_r($httpParsedResponseAr, true));
} else  {
	exit('GetExpressCheckoutDetails failed: ' . print_r($httpParsedResponseAr, true));
}


}





function doExpressCheckout($payerID,$token)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->$API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;

// Add request-specific fields to the request string.
$nvpStr = "&TOKEN=$token&PAYERID=$payerID&PAYMENTACTION=$paymentType&AMT=$paymentAmount&CURRENCYCODE=$currencyID";

// Execute the API operation; see the PPHttpPost function above.
$httpParsedResponseAr = $this->fn_doExpressCheckout('DoExpressCheckoutPayment', $nvpStr);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {

createRecurringPaymentsProfile($token);


	exit('Express Checkout Payment Completed Successfully: '.print_r($httpParsedResponseAr, true));
} else  {
	exit('DoExpressCheckoutPayment failed: ' . print_r($httpParsedResponseAr, true));
}
}

function createRecurringPaymentsProfile($token)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;
$billingPeriod=$this->billingPeriod;
$billingFreq=$this->billingFreq;


$token = $_REQUEST['token'];


$nvpStr="&TOKEN=$token&AMT=$paymentAmount&CURRENCYCODE=$currencyID&PROFILESTARTDATE=$startDate";
$nvpStr .= "&BILLINGPERIOD=$billingPeriod&BILLINGFREQUENCY=$billingFreq";

$httpParsedResponseAr = $this->fn_createRecurringPaymentsProfile('CreateRecurringPaymentsProfile', $nvpStr);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
	exit('CreateRecurringPaymentsProfile Completed Successfully: '.print_r($httpParsedResponseAr, true));
} else  {
	exit('CreateRecurringPaymentsProfile failed: ' . print_r($httpParsedResponseAr, true));
}

}






function fn_createRecurringPaymentsProfile($methodName_, $nvpStr_)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;
	$version = urlencode('51.0');

	// setting the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);

	// turning off the server and peer verification(TrustManager Concept).
	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);

	// NVPRequest for submitting to server
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

	// setting the nvpreq as POST FIELD to curl
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

	// getting response from server
	$httpResponse = curl_exec($ch);

	if(!$httpResponse) {
		exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
	}

	// Extract the RefundTransaction response details
	$httpResponseAr = explode("&", $httpResponse);

	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}

	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}

	return $httpParsedResponseAr;
}




function fn_setExpressCheckout($methodName_, $nvpStr_) {

$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;

	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
	}
	$version = urlencode('51.0');

	// Set the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);

	// Turn off the server and peer verification (TrustManager Concept).
	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, and API signature in the request.
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

	// Set the request as a POST FIELD for curl.
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

	// Get response from the server.
	$httpResponse = curl_exec($ch);

	if(!$httpResponse) {
		exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
	}

	// Extract the response details.
	$httpResponseAr = explode("&", $httpResponse);

	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}

	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}

	return $httpParsedResponseAr;
}





function fn_getExpressCheckout($methodName_, $nvpStr_)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;
	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
	}
	$version = urlencode('51.0');

	// Set the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);

	// Turn off the server and peer verification (TrustManager Concept).
	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, and API signature in the request.
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

	// Set the request as a POST FIELD for curl.
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

	// Get response from the server.
	$httpResponse = curl_exec($ch);

	if(!$httpResponse) {
		exit('$methodName_ failed: '.curl_error($ch).'('.curl_errno($ch).')');
	}

	// Extract the response details.
	$httpResponseAr = explode("&", $httpResponse);

	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}

	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}

	return $httpParsedResponseAr;

}


function fn_doExpressCheckout($methodName_, $nvpStr_)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;

	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
	}
	$version = urlencode('51.0');

	// setting the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);

	// Set the curl parameters.
	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, and API signature in the request.
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

	// Set the request as a POST FIELD for curl.
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

	// Get response from the server.
	$httpResponse = curl_exec($ch);

	if(!$httpResponse) {
		exit('$methodName_ failed: '.curl_error($ch).'('.curl_errno($ch).')');
	}

	// Extract the response details.
	$httpResponseAr = explode("&", $httpResponse);

	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}

	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}

	return $httpParsedResponseAr;
}

}

?>

custom widget in wp


register_sidebar( array(
'name' => 'Footer Sidebar 1',
'id' => 'footer-sidebar-1',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => 'Footer Sidebar 2',
'id' => 'footer-sidebar-2',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => 'Footer Sidebar 3',
'id' => 'footer-sidebar-3',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );

 

 

call in

 

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer 1') ) : ?>
<li>
<?php endif; ?>
</ul>

PHP Class For Authorize.net Automated Recurring Billing Payments API


‘m still testing and could find some small bugs which need to some polish, I’ll update this post and code if needed.

You will need to have an ARB enabled Authorize.net account, of course.

You can test the class with the following sample code:

<?php
  require_once("AuthnetARB.class.php");

$login = ‘cnpdev4289’; $transkey = ‘SR2P8g4jdEn7vFLQ’; $test = TRUE;

$arb = new AuthnetARB($login, $transkey, $test);

$arb->setParameter(‘interval_length’, 1); $arb->setParameter(‘interval_unit’, ‘months’); $arb->setParameter(‘startDate’, date(“Y-m-d”)); $arb->setParameter(‘totalOccurrences’, 12); $arb->setParameter(‘trialOccurrences’, 0); $arb->setParameter(‘trialAmount’, 0.00);

$arb->setParameter(‘amount’, 1.00); $arb->setParameter(‘refId’, 15); $arb->setParameter(‘cardNumber’, ‘5424000000000015’); $arb->setParameter(‘expirationDate’, ‘2009-05’);

$arb->setParameter(‘firstName’, ‘Joe’); $arb->setParameter(‘lastName’, ‘Doe’); $arb->setParameter(‘address’, ‘Casa 1872’); $arb->setParameter(‘city’, ‘City’); $arb->setParameter(‘state’, ‘FL’); $arb->setParameter(‘zip’, ‘33619’); $arb->setParameter(‘country’, ‘us’);

$arb->setParameter(‘subscrName’, ‘The Test Account’); $arb->createAccount();

echo ‘isSuccessful: ‘ .$arb->isSuccessful() . ‘<br />’;

if ($arb->isSuccessful()) { echo ‘cool, it worked! <br />’; } else { echo ‘error in payment <br />’; }

echo ‘isError: ‘ .$arb->isError() . ‘<br />’; echo ‘getSubscriberID: ‘ .$arb->getSubscriberID() . ‘<br />’; echo ‘getResponse: ‘ .$arb->getResponse() . ‘<br />’; echo ‘getResultCode:’ .$arb->getResultCode() . ‘<br />’; echo ‘getString: ‘ .$arb->getString() . ‘<br />’; echo ‘getRawResponse: ‘ .$arb->getRawResponse() . ‘<br />’; ?>

download class AuthnetARB.class.php