Song Lyrics: lrc2srt and srt2json

LRC2SRT.php <?php function lrc2srt( $lrc ) { $lrc = explode( “\n”, $lrc ); $srt = “”; $lines = array(); foreach ( $lrc as $lrcl ) { if ( preg_match( “|\[(\d\d)\:(\d\d)\.(\d\d)\](.+)|”, $lrcl, $m ) ) { $lines[] = array( ‘time’ => “00:{$m[1]}:{$m[2]},{$m[3]}0”, // convert to SubRip-style time ‘lyrics’ => trim( $m[4] ) ); } } for … Read more

Amazon DynamoDB PHP CRUD using aws.phar

DynamoDB is fully managed, fast and low cost NoSQL database service by Amazon. DynamoDB allows you to offload the administrative operations and scale highly distributed database cluster. The AWS SDK PHP enables you to use Amazon Web Services like Amazon S3, EC2, RDS, CloudFront, Redshift, DynamoDB, Push Notification Service (SNS) and more from your PHP … Read more

Top 10 Tutorials for your Drupal Website

Drupal is one of the most popular and powerful content management systems. Creating your website with Drupal will allow you endless options for design and function. Use these 10 Drupal tutorials to easily give your website features and options you may have never thought possible. 1. Tutorial For Site Setup Every Drupal website owner should … Read more

Importing data from non-wordpress mysql database

You have to create an import php file to get the Questions/Answers from a non-wordpress database and bring them into posts in wordpress. Question Table <?php /// non-wordpress database connection string here require(‘./wp-load.php’); $results = mysql_query(“SELECT * FROM questions”); while ($row = mysql_fetch_assoc($results)) {     $post_information = array( ‘post_title’ => wp_strip_all_tags( $row[‘question’] ), ‘post_content’ => $row[‘answer’], … Read more

User Agent Parsing with PHP

Tobie Langel’s ua-parser, a great library which provides simple UA parsing in PHP, JavaScript and Python. <?php require_once ‘uaparser.php’; $ua = $_SERVER[‘HTTP_USER_AGENT’]; $parser = new UAParser(); $result = $parser->parse($ua); echo ‘<pre>’; print_r($result); ?> Find more libraries here… https://github.com/rjd22/ua-parser/tree/master/php https://github.com/Synchro/ua-parser

Select2Array

It’s easy to convert PHP Array to Select Dropdown Box… you need to loop for all element in array to display as dropdown. But may be you ever think for reverse process. Yes, it’s also easy! You need to scrape / crawl Select box HTML to get PHP Array back from HTML Select Box. Please … Read more

Wowza Live Stream Countdown

<?php function timeElapsed($originalTime){         $timeElapsed=$originalTime-time(); return $timeElapsed; } //$Details[‘datetimepicker’] = “06/26/2014 11:42 am”; // coming from database $dtp = timeElapsed( strtotime($Details[‘datetimepicker’]) ); ?> var myCountdownTest = new Countdown({ time: <?php echo $dtp; ?>, width : 300, height : 50, style:”boring”, rangeHi:”day”, labelText : { second : “SECONDS”, minute : “MINUTES”, hour : “HOURS”, day : “DAYS”, … Read more

Secure Expired MP3 File

Secure Expired MP3 File can be used for hiding real mp3 link inside html source using base64_encode, mcrypt_encrypt, base64_decode, mcrypt_decrypt and md5. MP3 link will be expired in few seconds then it will return No Access Page to protect MP3 files to hot linked. I was working on Secured & Expired MP3 Link in HTML5 … Read more

PayPal auto redirect credit card user to website after payment

I have a problem on my Pay Per Video Website (PPV), Guests normally watch preview of videos for few seconds then PayPal Screen appear to watch full version of video content. Pay Per Plugin for HTML5 Media – Pay Per Plugin for HTML5 Media Plugin is embedded stand-alone, e-commerce-powered JavaScript and iFramed widget for Audio/Video. … Read more