Friday 25 July 2014

Convert text via Google to voice using Jquery and PHP

This tutorial teaches you how to convert Text To Speech via Google API using Jquery and PHP.

The system sends a HTTP GET request to Google Speech URL that does the conversion of text to an MP3 audio file as an out put.

Below is a sample URL through which the request to Google is made.

http://translate.google.com/translate_tts?ie=UTF-8&q=The text to convert&tl=en&total=4&textlen=19

Explanation for the above URL is shown below:

(1) ie -> This is the encoding format used. The default as seen in the URL above is: UTF-8
(2) q -> This is the query string. URL encoding is a necessity for this field especially when the string contains special characters.
(3) tl -> This is the language to which the conversion will be done. This means the mp3 audio file will be read in this language. You can get the list of Google supported languages here https://developers.google.com/translate/v2/using_rest#language-params
(4) total -> This is the total of words to be converted.
(5) textlen -> This is the lenghth of text to be converted. The maximum is 100 characters.


PayPal Integration using PHP

This tutorial teaches you how to easily integrate PayPal payment system on your website using PHP.

PayPal has become the most popular method of on-line payment in recent years due to the fact that it is safe, convenient and reliable.

PayPal payment system seems to be generally accepted worldwide.

Because of its ongoing popularity, it has become a necessity for on-line retailers to utilize this method of payment system on their websites.

This system is made up of two major parts which are listed below.

(1) A web page that processes the payment and this page contains the information of the user who is about to make a payment, the information of the payment and initiates a request to PayPal to make the payment.

(2) A web page that confirms the above payment and continues on to the next phase of your web application such as a 'Cancelled transaction Page', 'Completed transaction page' or 'Notification page' depending on the status of the payment brought from PayPal.

This system uses the RC4 algorithm to encrypt and decrypt the data sent via the URL to PayPal and later brought back from PayPal to your website for identification/activation purpose.

To use this system, the first step to take is to create a PayPal account If you do not already have one.

The next step is to open the file named payments.php after you must have downloaded the script and fill in the following information or create a session on the payments.php page then use the username or email address of the user accessing this page based on the session which has been created to get the information you need for the user/payment from your database and then pass these information to the codes below for processing.

$payment_mode = "Test"; // "Live" or "Test"
$user_or_payer_email_address = "info@vasplus.info"; // This is the email address of your user that is about to make a payment
$paypal_email = 'vasplusblog@yahoo.com'; // This is your paypal email address
$your_website_logo_url = "http://example.com/logo/logo.png"; // This is the URL to your website logo
$item_name = 'PayPal Integration Demo'; // This is the name of the item that a user is about to pay for
$item_amount = 1.00; // This is the amount charged for the item that a user is about to pay for
$currency_code = 'USD'; // The currency that you wish to accept on your site

Once you have completed the above settings, you are done to start using the system.