This is very-very-very raw; and not necessarily the best solution. What this will do is obtain a web page specified, then print out the data as it is received.

$site = “http://www.holwegner.com/”; $raw = implode(‘’, file ($site)); echo $raw;

Eventually, I will follow iup with the proper means to encode the data as it is found, with provisions for ‘clicking’ through; having this program rewrite the URLs through itself as a ‘proper’ server-side proxy.

Before I get back on the road yet again, here’s a quick little (horrible) PHP snippit. A friend of mine is learning PHP, and asked me how to strip all of the ‘unprintable’ characters out of a string. ctype_alpha() can not be considered portable enough yet, and of course, there is no isascii() in PHP… not to mention that PHP’s string manipulation is haphazard and slow – at best.

Here’s what I ended up giving him. It’s a trivial little hack that accepts two variables; a string (of course), and a boolean, “dots” to replace unprintable characters with periods. It’s highly tied to the ASCII character set.

function nonascii_string_cleaning($myText, $dots = FALSE) { $trans_array = array(); // This is the lower (unprintable) ASCII character set for ($i = 0; $i < 32; $i++) { $trans_array[chr($i)] = ($dots) ? ”.” : “”; } // This is the “higher” (unprintable) ASCII character set for ($i = 129; $i < 255; $i++) { $trans_array[chr($i)] = ($dots) ? ”.” : “”; } $replaced = strtr($myText, $trans_array); return $replaced; }

Horrid Example (Yes, this is what he wanted to do:)

It’s pretty simple, if not mostly-useless. Still, this makes me wish there were more C-like functions in PHP. Come on, guys! This would have been much better with isalpha() and an intelligent getchar() type of ordeal. Sure, it’s possible to use a file handle, or pass things as an array; but with my testing, and his requirement of it accepting a string, this came out about as fast and ‘bare wire’ as possible, while still being legible. Note my use of the ternary operators. ;)

[Edit: forgot to close a span tag. Oops.]

uhm...

This is an interesting coincidence…


A friend across-country found this in the paper today, and knowing that I lived in the San Francisco area felt the “need” to forward it on. Thanks, SG – it gave myself, and a few other local friends a nice chuckle.

For the last few months, my bandwidth use as been increasing; and my pageviews have stayed relatively the same. Upon researching this, I’ve discovered that many places are now “hotlinking” directly to my programs, which means that the user might no idea what, or where they are getting the software from. Worse, they most likely are unaware of whom to contact for support!

As mentioned in this post on my forums; I now do a test to see if my files are being referenced locally, or from one of my other sites. If this is the case, the file will download as normal; otherwise, the user will be redirected to my software page.

I apologize for any inconvenience this may cause.