While Bec was off shooting off Firecrackers this weekend, I did something I've been wanting to get at for months - if not years.

I checked the links to my videos on the popular VOD sites, and my Books and eBooks on the book sites.

Over the past 10 years, those sites have frequently moved things around (301 error), so the URL I copied when the title originally went live, sometimes is now something different. The 301 error is not a fatal error like the 404 error, but I like to be accurate.

I wrote a PHP script that takes the URL I have, and tries to open the page on the VOD or Book site. If it gets a 200 response, all is well. Even a 302 "Found". But a 301 is a "Moved Permanently," and I need to change it. 404 means they lost the file or deleted the title. Things break!

Here's an example of a title that someone moved (This is the $http_response_header value. This is what the Host is responding with. It is an Array, so you can print_r($http_response_header), after you have fopen(ed) the URL)

Array ( [0] => HTTP/1.1 301 Moved Permanently [1] => Date: Sun, 05 Jul 2015 23:20:08 GMT [2] => Server: Apache [3] => Set-Cookie: PHPSESSID=u92s4eie0bleiad61q9e396j87; path=/ [4] => Expires: Thu, 19 Nov 1981 08:52:00 GMT [5] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [6] => Pragma: no-cache [7] => Location: http://www.gayhotmovies.com/video/16....hotmovies.com [8] => Content-Length: 0 [9] => Content-Type: text/html; charset=UTF-8 [10] => HTTP/1.1 200 OK [11] => Date: Sun, 05 Jul 2015 23:20:08 GMT [12] => Server: Apache [13] => Set-Cookie: PHPSESSID=a4ob36uk3nbrcenb1i0e4j6r64; path=/ [14] => Expires: Thu, 19 Nov 1981 08:52:00 GMT [15] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [16] => Pragma: no-cache [17] => Set-Cookie: CLICK=111638; expires=Sun, 19-Jul-2015 23:20:08 GMT; path=/; domain=.gayhotmovies.com [18] => Vary: User-Agent [19] => Content-Language: en [20] => Set-Cookie: offer=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/ [21] => Connection: close [22] => Content-Type: text/html; charset=utf-8 )
It says that in [0].

The new location URL is in [7].



This is what is looks like when fixed:

Array ( [0] => HTTP/1.1 200 OK [1] => Date: Sun, 05 Jul 2015 23:20:24 GMT [2] => Server: Apache [3] => Set-Cookie: PHPSESSID=sks0l3h1j5k5guh1d9ljl6ecm1; path=/ [4] => Expires: Thu, 19 Nov 1981 08:52:00 GMT [5] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [6] => Pragma: no-cache [7] => Set-Cookie: CLICK=111638; expires=Sun, 19-Jul-2015 23:20:24 GMT; path=/; domain=.gayhotmovies.com [8] => Vary: User-Agent [9] => Content-Language: en [10] => Set-Cookie: offer=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/ [11] => Connection: close [12] => Content-Type: text/html; charset=utf-8 )


This is important, because the 301 Error falls in the range of "redirects". I've fixed titles this weekend, sometimes as many as 4 times each. That's 4 redirects! That can slow things down for my customers, or cause an attempt to view one of my titles on a VOD or Book site to fail. Some web browsers get fussy when there's too many redirects. Titles needing fixing generally are titles that went live in a certain time range, 2010-2012, which is kind of when some companies were moving to Cloud content management services.