Pages

Tuesday, 10 December 2013

How to integrate paypal by php

Paypal is the most used online payment gateway in the world. It is secured for both buyer and seller. So, for online transaction both buyers and sellers like to use it. But how PayPal gateway is integrated in web? A lot of tutorials are available in online. I will discuss here about the easiest way to integrate.

I will use PHP language for integrate it.

First Step: Create a Form

Keep the information of product items that you want to sell in a form. It is just a html form tag (<form>). Below is an example of a form:

<form action="https://www.paypal.com/cgi-bin/webscr" method="POST">

<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="nurulsnit@gmail.com">
<input type="hidden" name="item_name" id="item_name" value="My Product" />           
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="amount" value="10" />

<input type="submit" value="Buy Now"  />

</form>

Explanation of the above code:
Form action = https://www.paypal.com/cgi-bin/webscr. It is live paypal link. If you want to test the payment you can use sandbox paypal link. ( Sandbox is a test mode of paypal, in next post i will discuss about sandbox ).

Sandbox form action will be = https://www.sandbox.paypal.com/cgi-bin/webscr

<input type="hidden" name="cmd" value="_xclick" />, it is an essential variable for paypal transaction. This is a hidden type variable which name is cmd and value = _xclick.

business variable contains your paypal business account mail address. In this paypal account the payment will send. It is the seller paypal id.
item_name is the product name which is selling or purchasing.
currency_code is the currency name of transaction.
amount is the product price amount.
        

Monday, 25 November 2013

Date format change by php code

For software development we need different types of date format.

We can do it by a simple line of code. There is an example below:
$cdate = '2013-10-25';  // Y-m-d format
$rdate = date("d-m-Y",strtotime($cdate));  // d-m-Y format
echo $rdate;
I think it will help you.

Tuesday, 12 November 2013

Take difinite number of word from a string

The following function is for to take a definite number of words from an string:

function take_definite_number_word( $words = 10)
{
     $wordCount = count(explode("",$item->description));      // count by space
     if ($wordCount<$words)
    {
            $adjustedText = $item->description;
     }
     else
    {
          $adjustedText = implode(" ", array_slice(explode(" ",$item->description), 0, $words));
    }
}

Sunday, 29 September 2013

youtube video is not showing in Mozilla Firefox but google chorome and safary ok

It is a recent problem/bug with Mozilla Firefox browser.
We know, in your computer the browser is updating each time if you are net connected.
If you open your Mozilla Firefox browser and click on Help->About Firefox the it search the latest version of Firefox and update it.

In latest version of Mozilla Firefox it is now showing embeded  videos like youtube.
If you get this problem  that youtube video is not showing in Mozilla Firefox but in Google chrome and safari it is showing the videos then you will have to do the following tasks.

1. Clear the cache  from Tools->Options->Advanced->Network tab Ofline web content and user data. Click on Clear Now Button.

2. Now go to Tools -> Options -> Privacy .  Click on remove individual cookies link at the last line in History section.

If you load the video by iframe just add https:// ( dont use http:// ). ie. https://www.youtube.com

This will fix your bug.

Monday, 23 September 2013

Online Income Types

If you want to be expert in IT profession, then at first you will have to make your mind that anyhow i will be IT expert.

There are lots of non IT works in online too. But those are low price than IT work hour rates. So it is better to adopt IT techniques.

If you have a rich elance or odesk profile then it will be easy to get works.

There are lots of freelancing sites in online. but you will have to work from reliable sites.

Learn php

Now we will start learning php:

at first you will use the php start tag <?php

then write your codes, suppose:   echo "This is my firt line of code!";

then close the php tag by ?>

If you run it in server then we will get the following output:

 This is my firt line of code!

so the code is here:

<?php

  echo "This is my firt line of code!";

?>

Tuesday, 30 July 2013

how turn off magic quote in server

at first create a file named php.ini
write the following code in the php.ini file,
magic_quotes_gpc = Off
extension=pdo.so
extension=pdo_mysql.so

then upload it to root folder. i.e. in your site root folder.

Then create a .htaccess file in root folder

put the following code in top of the .htaccess file
<IfModule mod_suphp.c>
  suPHP_ConfigPath /home/myusername/public_html/yourJ3folder
  <Files php.ini>
    order allow,deny
    deny from all
  </Files>
</IfModule>

Change "myusername" and "yourJ3folder" to your respective folders.
The "/home/myusername/public_html/yourJ3folder" can be found via 
the Global Configuration