Pure PHP PHP unconventional 2009-05-04T08:06:29Z WordPress /feed/atom admin http://www.wahid.de <![CDATA[Reading HTTP Status Codes with PHP]]> /?p=13 2009-05-04T08:06:29Z 2009-05-04T08:02:26Z 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.

]]>
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.

]]>
0
admin http://www.wahid.de <![CDATA[PHP rules the web]]> /?p=11 2009-03-10T07:42:15Z 2009-03-10T07:42:15Z 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.

]]>
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.

]]>
0
admin http://www.wahid.de <![CDATA[Google Charts API with PHP]]> /?p=10 2008-04-24T07:01:38Z 2008-04-24T06:47:13Z Ludwig Pettersson has written a class that allows you to conveniently create charts with PHP and Google Charts API.
Google Charts is a simple API that lets you create various types of charts. To create a chart, you just need to call a URL with specific parameters and you receive an image back.

This is greatly simplified with a PHP class.


$data = array(
'IE7' => 22,
'IE6' => 30.7,
'IE5' => 1.7,
'Firefox' => 36.5,
'Mozilla' => 1.1,
'Safari' => 2,
'Opera' => 1.4,
);

$chart = new googChart();
$chart->setChartAttrs( array(
'type' => 'pie',
'data' => $data,
'size' => array( 300, 200 )
));
echo $chart;

Die Ausgabe:
Chart

]]>
Ludwig Pettersson has written a class that allows you to conveniently create charts with PHP and Google Charts API.
Google Charts is a simple API that lets you create various types of charts. To create a chart, you just need to call a URL with specific parameters and you receive an image back.

This is greatly simplified with a PHP class.


$data = array(
'IE7' => 22,
'IE6' => 30.7,
'IE5' => 1.7,
'Firefox' => 36.5,
'Mozilla' => 1.1,
'Safari' => 2,
'Opera' => 1.4,
);

$chart = new googChart();
$chart->setChartAttrs( array(
'type' => 'pie',
'data' => $data,
'size' => array( 300, 200 )
));
echo $chart;

Die Ausgabe:
Chart

]]>
0
admin http://www.wahid.de <![CDATA[Calculating Distance with SQL]]> /?p=9 2008-04-23T08:00:31Z 2008-04-23T07:59:55Z It sometimes makes work a bit easier when you calculate certain operations directly with SQL.
A practical example is the calculation of distances. In some projects I calculated this with PHP.

It can also be done directly with SQL
SELECT *, SQRT(POW(L2.lat - L1.lat, 2) + POW(L2.lng - L1.lng, 2)) AS Distance

Via

]]>
It sometimes makes work a bit easier when you calculate certain operations directly with SQL.
A practical example is the calculation of distances. In some projects I calculated this with PHP.

It can also be done directly with SQL
SELECT *, SQRT(POW(L2.lat - L1.lat, 2) + POW(L2.lng - L1.lng, 2)) AS Distance

Via

]]>
0
admin http://www.wahid.de <![CDATA[Alyverde via Email]]> /?p=8 2008-04-23T15:14:17Z 2008-04-23T07:00:04Z 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?

]]>
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?

]]>
1
admin http://www.wahid.de <![CDATA[Sun Buys MySQL]]> /archives/7 2008-01-16T15:06:16Z 2008-01-16T15:06:16Z Sun Buys MySQL AB for approximately one billion US dollars. The news is quite significant. I have already written about it here. But what does this mean for PHP?
Could it be that more attention will be paid to Java compatibility? Possibly.
If anyone has this concern, MySQL will continue to remain open source. However, Sun could use this to push its programming language Java more aggressively, as Java has recently been losing ground on the web to PHP and Ruby.

More at Golem und Heise.

]]>
Sun Buys MySQL AB for approximately one billion US dollars. The news is quite significant. I have already written about it here. But what does this mean for PHP?
Could it be that more attention will be paid to Java compatibility? Possibly.
If anyone has this concern, MySQL will continue to remain open source. However, Sun could use this to push its programming language Java more aggressively, as Java has recently been losing ground on the web to PHP and Ruby.

More at Golem und Heise.

]]>
0
admin http://www.wahid.de <![CDATA[Looking for Good PHP Blogs]]> /archives/6 2008-03-11T20:43:24Z 2007-12-28T08:53:46Z I know many good English-language PHP blogs, but not a single German-language one.
Can someone recommend a few? Gerne auch mittels Kommentar.

]]>
I know many good English-language PHP blogs, but not a single German-language one.
Can someone recommend a few? Gerne auch mittels Kommentar.

]]>
0
admin http://www.wahid.de <![CDATA[Zend_Service_SlideShare accepted into the Zend Framework incubator]]> /?p=5 2007-12-11T09:44:29Z 2007-12-11T09:43:09Z John Coggeshall’s Zend_Service_SlideShare ist accepted into the Zend Framework incubator. That is a good news, but why doesn’t anyone wirtes a Zend_Service_Paypal?

]]>
John Coggeshall’s Zend_Service_SlideShare ist accepted into the Zend Framework incubator. That is a good news, but why doesn’t anyone wirtes a Zend_Service_Paypal?

]]>
0
admin http://www.wahid.de <![CDATA[Pure-PHP is back]]> /?p=4 2007-12-11T09:39:21Z 2007-12-11T09:39:21Z After a long time of absence Pure-PHP  ist back online. Now I use Wordpress, I know ist is not  the best blogging  solution for phpers, but  it is  written at least in PHP;-)

]]>
After a long time of absence Pure-PHP  ist back online. Now I use Wordpress, I know ist is not  the best blogging  solution for phpers, but  it is  written at least in PHP;-)

]]>
0
admin http://www.wahid.de <![CDATA[Hello world!]]> 2008-03-11T20:43:08Z 2007-10-15T16:22:06Z Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

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

]]>
2