Put solat time in conky|Pasang jadual solat di conky

If you’re linux user and want to put solat time in your concy.. just do the following step. I make this code a few week ago because most of my time is in front of computer. So it would be easy if I put this solat time in the place that I can easily to see.

1. create a php file name solat.php and put it in your webroot directory. Copy this code and paste in your solat.php . This code will get solat timetable from e-solat.gov.my . You can change url get parameter with your own need. Please refer to http://www.e-solat.gov.my/ for more detail.

$data = file_get_contents('http://www.e-solat.gov.my/solat.php?kod=SGR03 & lang=BM&url=http://google.com');
$data = strip_tags($data,'<table><tr><td></td></tr></table>');
$data = str_replace(" ","",$data);

$dom = new DOMDocument();
$dom->prevservWhiteSpace = false;
$dom->loadHTML($data);
$trs = $dom->getElementsByTagName('tr');
foreach( $trs as $tr){
	$td = $tr->getElementsByTagName('td');
	$result = array();
	foreach($td as $row){
		$result[] = trim($row->nodeValue);
	}
	$results[] = $result;
}

echo $results[5][0] . '       ' .$results[5][1] . "n";
echo '   '. $results[6][0] . '      ' .$results[6][1] . "n";
echo '   '. $results[7][0] . '     ' .$results[7][1] . "n";
echo '   '. $results[8][0] . '      ' .$results[8][1] . "n";
echo '   '. $results[9][0] . '        ' .$results[9][1] . "n";
echo '   '. $results[10][0] . '   ' .$results[10][1] . "n";
echo '   '. $results[11][0] . '       ' .$results[11][1] . "n";

2. create shell script solat.sh and put into your concy script folder. Copy and paste this code inside solat.sh

URI=http://localhost/rnd/solat/solat.php
EXEC="/usr/bin/curl -s"
$EXEC $URI

[lang_en-us]Please change URL to your own. Usually http://localhost/solat.php if you put solat.php script inside your webroot directory

3. Edit your .concyrc file and add this code

${font Radio Space:size=14}Solat Time
${font}
${texeci 900 ./scripts/solat.sh}

result

About ibnuyahya

Ibnuyahya has written 104 post in this blog.

Ibnuyahya merupakan seorang software developer dan freelance consultant. Berpengalaman lebih dari 10 tahun dalam membangunkan perisian dari embedded sistem menggunakan micro-controller, windows application, mobile, image processing, artificial intelligent dan akhirnya menumpukan sepenuh tenaga dalam web application.