Redirecting non-www to www with .htaccess

PHP
If your website can be access both way with and without www. So may search engines consider same content with two different URLs with and without www. So it might be a case of Duplicate Content as well as Google Canonical problems. So you must stick your domain name accessible either with www or without www. Before writing this rules in .htaccess , make sure that your mod_rewrite is enabled(On). Most probably mod_rewrite is enabled in Linux server but for windows server you need to contact hosting people to make mod_rewrite enabled. You can check this by looking in phpinfo(). How to redirect www to non-www and non-www to www URL using .htaccess redirect Redirect www to non-www: [sourcecode language="plain"] RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.justwebdevelopment.com [NC] RewriteRule ^(.*)$…
Read More

Execute PHP code in .html file

PHP
Only way to execute PHP code on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html file [sourcecode language="plain"]AddType application/x-httpd-php .html[/sourcecode] Or for .htm file [sourcecode language="plain"]AddType application/x-httpd-php .htm[/sourcecode] If you only plan on including the PHP on one page, it is better to setup this way: [sourcecode language="plain"] <Files yourpage.html> AddType application/x-httpd-php .html </Files> [/sourcecode] This code will only make the PHP executable on the yourpage.html file, and not on all of your html pages. [JWD-Web-Development]
Read More

Check youtube video is still valid

PHP
Check youtube video is still valid using youtube's API Manytimes youtube user can decide to delete their video. So I would like to periodically run a script to check that the youtube video is still valid or not. Also, you can fine best video review apps for shopify and make better your Shopify theme. Suppose your Youtube url is : http://www.youtube.com/v/jc0rnCBCX2c So here your Youtube video Id is jc0rnCBCX2c $vid [video Id] posible format/sintax: 1. http://www.youtube.com/watch?v=[ID]&feature=…&… 2. http://www.youtube.com/watch?v=[ID] 3. www.youtube.com/watch?v=[ID] 4. youtube.com/watch?v=[ID] 5. http ://www.youtube.com/v/[ID] 6. www.youtube.com/v/[ID] 7. youtube.com/v/[ID] 8. [ID] 9. …. and any valid youtube video url [php]&amp;amp;lt;?php function checkYoutubeId($id) { if (!$data = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$id)) return false; if ($data == "Video not found") return false; return true; } ?&amp;amp;gt; [/php] http://gdata.youtube.com/feeds/api/videos/jc0rnCBCX2c if it does not exist then you…
Read More

How to Use PHP to Obtain Stock Quotes from Yahoo Finance

PHP
Yahoo! Finance is a very useful resource for both analysts and programmers alike. A PHP library is created by saving the function into a text file - in this example the library is going to be called yahoo_finance.php and this will contain a single function: [php] <?php function show_stock_quotes ($stock_list) { //The function will, by default, return the details of some of the stock markets: if (! $stock_list) { $stock_list = "^IXIC,^DJA,^NIN,^FTSE"; } //The function will then use either an input list or the default list to create the correct url: $url = "http://quote.yahoo.com/d/quotes.csv?s=". $stock_list . "&f=nl1c1&e=.csv"; //and then read in the data stream from the Yahoo! Finance web site: $filesize = 2000; $handle = fopen($url, "r"); $raw_quote_data = fread($handle, $filesize); fclose($handle); //The data will be in the format: "BSE-100",4.37,0.47…
Read More

iDeal Payment Integration

PHP
What is iDEAL? iDEAL is a standardised payment method for making secure online payments directly between bank accounts. To offer iDEAL as a payment method in an online store, a direct link is established with the systems of participating banks. In other words, this one connection to iDEAL enables each webshop’s visitor with access to online banking of ABN AMRO, ASN Bank, Friesland Bank, ING, Rabobank, RegioBank, SNS Bank, Triodos Bank or Van Lanschot Bankiers to make payments in this way. No other payment product offers this facility. iDEAL is steadily gaining a reputation as a trusted online payment method. Already more than half of all Dutch online shoppers use iDEAL. How does iDEAL work? iDEAL is easy to use and requires just a few simple steps on the part…
Read More