Archivee for the 'Uncategorized' Category

Reading HTTP Status Codes with PHP

this morning I stumbled upon this blog post on phphatesme.com. The solution presented there for reading HTTP status codes works, but is not ideal. Moreover, the cURL extension is not installed by default at every web host. It can be done much more simply.


public static function getHttpCode( $url )
{
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
return $info['http_code'];
}

for reading HTTP status codes works, but is not ideal. Moreover, the cURL extension is not installed by default at every web host.

It can be done much more simply.


$info = get_headers( $url );
$status_code = $info[0];

get_headers gibt fast alle Header-Infos in ein Array zurück.

PHP rules the web

Ich hoffe, ihr verzeiht mit den provokativen Titel, aber da ist dran. PHP is the most important programming language for web applications. Das hat auch eine Studie von Evans Data Corporation, confirmed. Demnach ist PHP populärer als Ruby und Python. Nicht umsonst setzen die größten Web 2.0 Seiten, wie Facebook, Studivz, Wer-Kennt-wen, Wikipedia, Wordpress.com rely on PHP.

Alyverde via Email

The spammers are getting more and more cunning. Is this something like behavioral spam? ;-)
Bekomme immer wieder Spam Mails mit dem Schlankheitsmittel Alyverde. How do the spammers know that I have weight problems?

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!