<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A.Niraj KumarAdvertisements</title>
	<atom:link href="http://www.anirajkumar.com/category/technology/advertisements/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anirajkumar.com</link>
	<description>A PHP, Wordpress as CMS set up and customization Expert developer from India</description>
	<lastBuildDate>Wed, 01 Feb 2012 14:08:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Payment Status</title>
		<link>http://www.anirajkumar.com/technology/advertisements/2009/payment-status/</link>
		<comments>http://www.anirajkumar.com/technology/advertisements/2009/payment-status/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 23:21:03 +0000</pubDate>
		<dc:creator>A Niraj Kumar</dc:creator>
				<category><![CDATA[Advertisements]]></category>

		<guid isPermaLink="false">http://www.anirajkumar.com/?p=389</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><?php<br />
// read the post from PayPal system and add 'cmd'<br />
$req = 'cmd=_notify-synch';</p>
<p>$tx_token = $_GET['tx'];<br />
$auth_token = "pPGdItDchYVHc-EJ3nnsi3yNFT9lsyEoQesiQeNZgbkFXEbKpmYt83_0iFe";<br />
$req .= "&#038;tx=$tx_token&#038;at=$auth_token";</p>
<p>// post back to PayPal system to validate<br />
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";<br />
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";<br />
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";<br />
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);<br />
// If possible, securely post back to paypal using HTTPS<br />
// Your PHP server will need to be SSL enabled<br />
// $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);</p>
<p>if (!$fp) {<br />
// HTTP ERROR<br />
} else {<br />
fputs ($fp, $header . $req);<br />
// read the body data<br />
$res = '';<br />
$headerdone = false;<br />
while (!feof($fp)) {<br />
$line = fgets ($fp, 1024);<br />
if (strcmp($line, "\r\n") == 0) {<br />
// read the header<br />
$headerdone = true;<br />
}<br />
else if ($headerdone)<br />
{<br />
// header has been read. now read the contents<br />
$res .= $line;<br />
}<br />
}</p>
<p>// parse the data<br />
$lines = explode("\n", $res);<br />
$keyarray = array();<br />
if (strcmp ($lines[0], "SUCCESS") == 0) {<br />
for ($i=1; $i<count($lines);$i++){<br />
list($key,$val) = explode("=", $lines[$i]);<br />
$keyarray[urldecode($key)] = urldecode($val);<br />
}<br />
// check the payment_status is Completed<br />
// check that txn_id has not been previously processed<br />
// check that receiver_email is your Primary PayPal email<br />
// check that payment_amount/payment_currency are correct<br />
// process payment</p>
<p>$firstname = $keyarray['first_name'];<br />
$lastname = $keyarray['last_name'];<br />
$itemname = $keyarray['item_name'];<br />
$amount = $keyarray['payment_gross'];<br />
$custom = $keyarray['custom'];</p>
<p>echo ("<br />
<h1 style='color:green;'>Thank you for your Payment!</h1>
</p>
<p>&#8220;);</p>
<p>echo (&#8220;<b>Payment Details</b><br />\n&#8221;);<br />
echo (&#8220;
<li>Name: $firstname $lastname</li>
<p>\n&#8221;);<br />
echo (&#8220;
<li>Item: $itemname</li>
<p>\n&#8221;);<br />
echo (&#8220;
<li>Amount: $amount</li>
<p>\n&#8221;);<br />
echo (&#8220;
<li>Custom Details: $custom</li>
<p>\n&#8221;);<br />
echo (&#8220;&#8221;);<br />
echo &#8216;
<div align="center">
<b style="color:green; font-size:17px;">Thanks! I got the Payment. </b><br/> <b style="color:green; font-size:14px;">A receipt for your payment has been emailed to you.</b><b style="color:green; font-size:14px;"> You may log into your account at <a href="https://www.paypal.com">www.paypal.com</a> to view details of this transaction.<br /></b></div>
<p>&#8216;;<br />
}<br />
else if (strcmp ($lines[0], &#8220;FAIL&#8221;) == 0) {<br />
// log for manual investigation</p>
<p>echo &#8216;
<div align="center" style="color:red;font-size:15px;">
<b>Sorry! Your transaction has been cancelled or Failed</b></div>
<p>&#8216;;<br />
}</p>
<p>}</p>
<p>fclose ($fp);</p>
<p>?><br />
<br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anirajkumar.com/technology/advertisements/2009/payment-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

