Author Archives: invtr

Use custom domain with blogger

If you want to use your own custom domain for blogspot.com

In your domain control panel

1. Update CNAME record

www.yourdomain.com -> ghs.google.com

*also applicable for any other subdomains

2. Update A records (for naked domain. i.e. yourdomain.com – without the www in front)

216.239.32.21
216.239.34.21
216.239.36.21
216.239.38.21

In your blogger setting

Settings -> Publishing -> Custom Domain -> Switch to advanced settings

Enter your domain name and the word verification then “Save Setting”

Refer here for google guide

Export as .csv with jQuery

This is so simple and very useful for reporting purpose. You can easily export your html table to .csv format with this jquery scripts.

Step 1: Html File

<form action="getCSV.php" method="post">
<input id="csv_text" name="csv_text" type="hidden" />
<input onclick="getCSVData()" type="submit" value="Get CSV File" />
 
<script type="text/javascript"><!--mce:0--></script>
</form>

Step 2: PHP File ( getCSV.php )

<!--?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"my-data.csv\"");
$data=stripcslashes($_REQUEST['csv_text']);
echo $data;
?-->

Thanks to the code writer
source: http://www.kunalbabre.com/projects/table2CSV.php

Run PHP file with cron

This is the script to paste in cron to run a PHP file

php -f /home/username/public_html/cron-daily.php

Anyway I haven’t tried to put the script outside public_html directory. Logically PHP cannot run outside web root folder unless you set it to run outside web root folder in apache.

And you can use this script to run PHP by full URL. Even script on other server

lynx -dump http://yourdomain.com/yourscript.php >/dev/null 2>&1