Purchase Perfect Money through api using php

About Perfect Money

Perfect Money is a leading financial service allowing the users to make instant payments and to make money transfers securely throughout the Internet opening unique opportunities to Internet users and owners of the Internet businesses. Perfect Money targets to bring the transactions on the Internet to the ideal level!

In this post you will learn how to implement Purchasing of Perfect money through Api on Php.

For successful implementation of this you need to get Perfect Money account credentials to put in the Api.

We will use HTTP method to get all the details and for the purchasing process.

Step 1.

In this step we will enter the Perfect Money credentials and verify the account number in which purchase amount will be credit.

Use below code for verfication process-

Step 2.

After verification completes successfully, In this step we will process the purchase of Perfect Money.

Use below code for purchase process-

Implement this code and after this your website is enabled for Perfect Money purchasing.

Text Helper in codeigniter

Text Helper

The Text Helper file contains functions that assist in working with text.

Loading this Helper

This helper is loaded using the following code:

Available Functions

The following functions are available:

word_limiter($str[, $limit = 100[, $end_char = ‘…’]])

  • $str (string) – Input string
  • $limit (int) – Limit
  • $end_char (string) – End character (usually an ellipsis)
  • Returns:Word-limited string
    Return type:string

    Truncates a string to the number of words specified. Example:

    The third parameter is an optional suffix added to the string. By default it adds an ellipsis.

    character_limiter($str[, $n = 500[, $end_char = ‘…’]])

  • $str (string) – Input string
  • $n (int) – Number of characters
  • $end_char (string) – End character (usually an ellipsis)
  • Returns:Character-limited string
    Return type:string

    Truncates a string to the number of characters specified. It maintains the integrity of words so the character count may be slightly more or less than what you specify.

    Usage example:

    The third parameter is an optional suffix added to the string, if undeclared this helper uses an ellipsis.

    Note! If you need to truncate to an exact number of characters please see the ellipsize() function below.


  • $str (string) – Input string
  • Returns:A string with ASCII values converted to entities
    Return type:string

    Converts ASCII values to character entities, including high ASCII and MS Word characters that can cause problems when used in a web page, so that they can be shown consistently regardless of browser settings or stored reliably in a database. There is some dependence on your server’s supported character sets, so it may not be 100% reliable in all cases, but for the most part it should correctly identify characters outside the normal range (like accented characters).



  • $str (string) – Input string
  • Returns:A string with accented characters converted
    Return type:string

    Transliterates high ASCII characters to low ASCII equivalents. Useful when non-English characters need to be used where only standard ASCII characters are safely used, for instance, in URLs.


    Note! This function uses a companion config file application/config/foreign_chars.php to define the to and from array for transliteration.

    word_censor($str, $censored[, $replacement = ”])

  • $str (string) – Input string
  • $censored (array) – List of bad words to censor
  • $replacement (string) – What to replace bad words with
  • Returns:Censored string
    Return type:string

    Enables you to censor words within a text string. The first parameter will contain the original string. The second will contain an array of words which you disallow. The third (optional) parameter can contain a replacement value for the words. If not specified they are replaced with pound signs: ####.



  • $str (string) – Input string
  • Returns:String with code highlighted via HTML
    Return type:string

    Colorizes a string of code (PHP, HTML, etc.). Example:

    The function uses PHP’s highlight_string() function, so the colors used are the ones specified in your php.ini file.

    highlight_phrase($str, $phrase[, $tag_open = ‘‘[, $tag_close = ‘‘]])

  • $str (string) – Input string
  • $phrase (string) – Phrase to highlight
  • $tag_open (string) – Opening tag used for the highlight
  • $tag_close (string) – Closing tag for the highlight
  • Returns:String with a phrase highlighted via HTML
    Return type:string

    Will highlight a phrase within a text string. The first parameter will contain the original string, the second will contain the phrase you wish to highlight. The third and fourth parameters will contain the opening/closing HTML tags you would like the phrase wrapped in.


    The above code prints:

    Note! This function used to use the tag by default. Older browsers might not support the new HTML5 mark tag, so it is recommended that you insert the following CSS code into your stylesheet if you need to support such browsers:

    word_wrap($str[, $charlim = 76])

  • $str (string) – Input string
  • $charlim (int) – Character limit
  • Returns:Word-wrapped string
    Return type:string

    Wraps text at the specified character count while maintaining complete words.


    ellipsize($str, $max_length[, $position = 1[, $ellipsis = ‘…’]])

  • $str (string) – Input string
  • $max_length (int) – String length limit
  • $position (mixed) – Position to split at (int or float)
  • $ellipsis (string) – What to use as the ellipsis character
  • Returns:Ellipsized string
    Return type:string

    This function will strip tags from a string, split it at a defined maximum length, and insert an ellipsis.

    The first parameter is the string to ellipsize, the second is the number of characters in the final string. The third parameter is where in the string the ellipsis should appear from 0 – 1, left to right. For example. a value of 1 will place the ellipsis at the right of the string, .5 in the middle, and 0 at the left.

    An optional forth parameter is the kind of ellipsis. By default, … will be inserted.



    How to get a YouTube video Image or Thumbnail

    In this post you will learn how to get you tube video images and thumbnails.

    There are various method to get Images or Thumbnails like using url manually or getting it from API. Below you will see both methods of getting this information.

    Method 1.

    Getting images manually using URL.

    Each YouTube video has 4 generated images. They are predictably formatted as follows:


    The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:


    For the high quality version of the thumbnail use a url similar to this:

    There is also a medium quality version of the thumbnail, using a url similar to the HQ:

    For the standard definition version of the thumbnail, use a url similar to this:

    For the maximum resolution version of the thumbnail use a url similar to this:

    All of the above urls are available over http too.

    Additionally, the slightly shorter hostname i3.ytimg.com works in place of img.youtube.com in the example urls above.

    Method 2.

    You can use YouTube Data API to retrieve video thumbnails, caption, description, rating, statistics and more. API version 3 requires a key*. Obtain the key and create a videos: list request:


    Example PHP Code


    NOTE: Not only that you need a key, you might be asked for billing information depending on the number of API requests you plan to make. However, few million requests per day are free.

    You can also user CURL method to get this output.

    Compatibility Functions in Codeigniter

    Compatibility Functions

    CodeIgniter provides a set of compatibility functions that enable you to use functions what are otherwise natively available in PHP, but only in higher versions or depending on a certain extension.

    Being custom implementations, these functions will also have some set of dependencies on their own, but are still useful if your PHP setup doesn’t offer them natively.

    Note: Much like the common functions, the compatibility functions are always available, as long as their dependencies are met.

    Password Hashing

    This set of compatibility functions offers a “backport” of PHP’s standard Password Hashing extension that is otherwise available only since PHP 5.5.


    1) PHP 5.3.7
    2) CRYPT_BLOWFISH support for crypt()



    Function reference

    Parameters: 1) $password (string) – Plain-text password
    2) $algo (int) – Hashing algorithm
    3) $options (array) – Hashing options

    Returns: Hashed password or FALSE on failure

    Return type: string

    For more information, please refer to the PHP manual for password_hash().

    Unless you provide your own (and valid) salt, this function has a further dependency on an available CSPRNG source. Each of the following would satisfy that: – mcrypt_create_iv() with MCRYPT_DEV_URANDOM – openssl_random_pseudo_bytes() – /dev/arandom – /dev/urandom

    Parameters: 1) $hash (string) – Password hash
    2) $algo (int) – Hashing algorithm
    3) $options (array) – Hashing options

    Returns: TRUE if the hash should be rehashed to match the given algorithm and options, FALSE otherwise

    Return type: bool

    For more information, please refer to the PHP manual for password_needs_rehash().

    Parameters: 1) $password (string) – Plain-text password
    2) $hash (string) – Password hash

    Returns: TRUE if the password matches the hash, FALSE if not

    Return type: bool

    For more information, please refer to the PHP manual for password_needs_rehash().

    Hash (Message Digest)

    This compatibility layer contains backports for the hash_equals() and hash_pbkdf2() functions, which otherwise require PHP 5.6 and/or PHP 5.5 respectively.


    1) None

    Function reference

    Parameters: 1) $known_string (string) – Known string
    2) $user_string (string) – User-supplied string

    Returns: TRUE if the strings match, FALSE otherwise

    Return type: string

    For more information, please refer to the PHP manual for hash_equals().

    Multibyte String

    This set of compatibility functions offers limited support for PHP’s Multibyte String extension. Because of the limited alternative solutions, only a few functions are available.

    When a character set parameter is ommited, $config[‘charset’] will be used.


    1) iconv extension

    Important: This dependency is optional and these functions will always be declared. If iconv is not available, they WILL fall-back to their non-mbstring versions.

    Important: Where a character set is supplied, it must be supported by iconv and in a format that it recognizes.

    Note: For you own dependency check on the actual mbstring extension, use the MB_ENABLED constant.

    Function reference

    Parameters: 1) $str (string) – Input string
    2) $encoding (string) – Character set
    Returns: Number of characters in the input string or FALSE on failure

    Return type: string

    For more information, please refer to the PHP manual for mb_strlen().

    Parameters: 1) $haystack (string) – String to search in
    2) $needle (string) – Part of string to search for
    3)$offset (int) – Search offset
    4) $encoding (string) – Character set

    Returns: Numeric character position of where $needle was found or FALSE if not found

    Return type: mixed

    For more information, please refer to the PHP manual for mb_strpos().

    Parameters: 1) $str (string) – Input string
    2) $start (int) – Position of first character
    3) $length (int) – Maximum number of characters
    4) $encoding (string) – Character set

    Returns: Portion of $str specified by $start and $length or FALSE on failure

    Return type: string

    For more information, please refer to the PHP manual for mb_substr().

    Standard Functions

    This set of compatibility functions offers support for a few standard functions in PHP that otherwise require a newer PHP version.


    1) None

    Function reference

    Parameters: 1) $array (array) – Array to fetch results from
    2) $column_key (mixed) – Key of the column to return values from
    3) $index_key (mixed) – Key to use for the returned values

    Returns: An array of values representing a single column from the input array

    Return type: array

    For more information, please refer to the PHP manual for array_column().

    Parameters: $data (array) – Hexadecimal representation of data

    Returns: Binary representation of the given data

    Return type: string

    For more information, please refer to the PHP manual for hex2bin().

    How to manage controllers in Codeigniter

    Controllers are the heart of your application, as they determine how HTTP requests should be handled.

    This post contains information as follows –

      1) What is a Controller?
      2) Hello World
      3) Functions
      4) Passing URI Segments to Your Functions
      5) Defining a Default Controller
      6) Remapping Function Calls
      7) Controlling Output Data
      8) Private Functions
      9) Organizing Controllers into Sub-folders
      10) Class Constructors
      11) Reserved Function Names

    Read More

    Auto-loading Resources

    CodeIgniter comes with an “Auto-load” feature that permits libraries, helpers, and models to be initialized automatically every time the system runs. If you need certain resources globally throughout your application you should consider auto-loading them for convenience.

    The following items can be loaded automatically:

    1) Classes found in the libraries/ directory
    2) Helper files found in the helpers/ directory
    3) Custom config files found in the config/ directory
    4) Language files found in the system/language/ directory
    5) Models found in the models/ folder

    To autoload resources, open the application/config/autoload.php file and add the item you want loaded to the autoload array. You’ll find instructions in that file corresponding to each type of item.

    Do not include the file extension (.php) when adding items to the autoload array.

    Additionally, if you want CodeIgniter to use a Composer auto-loader, just set $config[‘composer_autoload’] to TRUE or a custom path in application/config/config.php.