Archive for May 8th, 2009
PHP Script to get HTTP Status number
by z3n on May.08, 2009, under Coding, Tips & Hints
Problem:
Getting HTTP Status from a remote page.
Solution:
-
function cget_info($url) {
-
$ch=curl_init();
-
@curl_setopt_array($ch,array(
-
CURLOPT_URL => $url,
-
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 5.1) Gecko/2009042316 Firefox/3.0.10",
-
CURLOPT_RETURNTRANSFER => 1,
-
CURLOPT_VERBOSE => false,
-
CURLOPT_TIMEOUT => 5,
-
CURLOPT_MAXREDIRS => 0, // this will catch 302's
-
CURLOPT_RETURNTRANSFER => true,
-
CURLOPT_FOLLOWLOCATION => 1
-
));
-
@curl_exec($ch);
-
$r=curl_getinfo($ch,CURLINFO_HTTP_CODE);
-
curl_close($ch);
-
return $r;
-
}
-
-
echo cget_info("http://www.overflow.biz"); // 200
-
echo cget_info("http://www.overflow.biz/dfkjds"); // 404
-
-
?>
Restarting gnome-panel
by z3n on May.08, 2009, under Linux Happyness
Problem:
You followed the previous post and sucessfully installed Hardware monitor applet on your gnome, however it’s not showing. This is happening because gnome-panel didn’t updated it’s applets list, so you need to restart gnome-panel.
Solution:
There’s no cool way to do this, you need to kill the process, it will restart after that.
pkill -9 gnome-panel
Gnome hddtemp/sensors applet
by z3n on May.08, 2009, under Linux Happyness
Problem:
Monitor hardware, harddisk and other temperature, voltage and fan.
Solution:
yum install lm_sensors hddtemp gnome-applet-sensors
run sensors-detect to detect hardware sensors
then edit /etc/sysconfig/hddtemp and add your disks there
for multiple disks, example:
HDDTEMP_OPTIONS=”/dev/sd[abcdefg..]“
then you just need to run hddtemp and lm_sensors as deamon and done!
Note: if can’t see the Hardware monitor applet at gnome, read this.
Source: