Get IP range by CIDR notation

Get IP range by CIDR notation

šŸ“… — šŸ§® 258 words — šŸ·ļø tech php

I wanted to get the IPv4 range of a WHOIS record provided by LACNIC, because unlike other RIRs they don't supply you with the range, but with just a CIDR notation. To make matters worse, they give 'incomplete' net numbers. The only working "CIDR to IP range" function I could find didn't accept it, so I had to sprinkle some magic. <?php $ipdata = explode('/', ltrim($incomplete_cidr_notation, '0')); $dotcount = substr_count($ipdata[0], '.

šŸ’¬ Read more
Perfect separator for Shoutcast 7.html file

Perfect separator for Shoutcast 7.html file

šŸ“… — šŸ§® 173 words — šŸ·ļø tech php

To go along nicely with my previous Shoutcast tip, here is a trick to separate the data in the Shoutcast 7.html for displaying. If you, like me, use the Shoutcast 7.html trick to get some quick stats about your stream broadcast but are getting some inconsistencies with parsing the comma-separated input you get, try this: <?php $data = preg_split("/[,]+/", $string, 7); ?> A possible outcome would be this: <?php Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1000 [4] => 1 [5] => 192 [6] => "Woe, Is Me - Hell, or High Water" ) ?

šŸ’¬ Read more
How to programmatically add an IP address to a Shoutcast Reserved IP list in PHP

How to programmatically add an IP address to a Shoutcast Reserved IP list in PHP

šŸ“… — šŸ§® 353 words — šŸ·ļø tech php

Pretty semantic title, huh? But that's basically what this is all about. Shoutcast logo If you have a Shoutcast host that is set to private, only people whose IP address in the RIP list (Reserved IP) can access your stream. A lot of free Shoutcast server providers do this, to make it a bit less profitable to free ride their services. Let's have a quick look at the code and then analyze it to understand what it's doing.

šŸ’¬ Read more
array_push_insert: Push new value into array with PHP

array_push_insert: Push new value into array with PHP

šŸ“… — šŸ§® 326 words — šŸ·ļø tech php

This blogpost is for historical purposes. There is a better way with array_splice. At work today, my colleague needed to add, or rather 'insert', a value into an existing array AND on a specific index. This because we fed it into a JS table sorter, once we pulled it through json_encode(). So what we really required: array_push_insert We couldn't find any existing Array function at php.net, so I decided to make my own version.

šŸ’¬ Read more
T-Mobile traffic through http://1.2.3.12

T-Mobile traffic through http://1.2.3.12

šŸ“… — šŸ§® 524 words — šŸ·ļø tech

I'm at a place where there's no internet, so I hooked up my T-Mobile G1 (an HTC Dream) to my laptop through the PdaNet app. When I was browsing a site, I noticed an image that wasn't working. So I opened it up in a new tab, where it seemed to work again, but I then noticed the URL. The http:// part of the original source was dropped and replaced by http://1.

šŸ’¬ Read more
Black and white picture of Gerben Jacobs
Hi!

Iā€™m a 35-year-old software engineer from The Netherlands. My interests lie with (web)development, databases, design patterns, social media, communities, APIs and open data.

More about me, including links to other online services, can be found at gerben.dev

Tags

go 1 personal 10 php 5 roi-stock-portfolio 3 scandinavia-2013 3 stocks 3 tech 17 web 1 youtube 1

Socials

Meta