Jump to content

Validate and open URL with PHP...


Badchip

Recommended Posts

I want to open a TV channel with a click. This channel have 3 random/variable URL's. (usually only one works)

 

$player = 'http://videoplayer.vodobox.com/vodobox_player.php?vid=';$enlace1 = 'http://mdsiosgeo1-lh.akamaihd.net/i/mitele/esmediaset_11@168495/index_0_av-b.m3u8';$enlace2 = 'http://mdsios1-lh.akamaihd.net/i/mitele/esmediaset_11@168471/index_0_av-b.m3u8';$enlace3 = 'http://mdsios2-lh.akamaihd.net/i/mitele/esmediaset_21@168473/index_0_av-b.m3u8';function checkURL($url) {$headers = get_headers($url);if (preg_match('/^HTTP/d.ds+(200|301|302)/', $headers[0])){return true;}else return false;}?>if (checkURL($enlace1)) { echo ('');}else if (checkURL($enlace2)) {echo ('');}else if (checkURL($enlace3)) {echo ('');}?>

 

 

 

I receive this error: (try the debug here)

 

http://mdsiosgeo1-lh.akamaihd.net/i/mitele/esmediaset_11@168495/index_0_av-b.m3u8 ====> HTTP/1.0 403 Forbiddenhttp://mdsios1-lh.akamaihd.net/i/mitele/esmediaset_11@168471/index_0_av-b.m3u8 ====> HTTP/1.0 200 OKhttp://mdsios2-lh.akamaihd.net/i/mitele/esmediaset_21@168473/index_0_av-b.m3u8 ====> HTTP/1.0 200 OK

 

However I can open/download the URL http://mdsiosgeo1-lh.akamaihd.net/i/mitele/esmediaset_11@168495/index_0_av-b.m3u8 without problems.

("http://mdsiosgeo1..." URL (geo) only works in Spain).

 

Is there any alternative to skip this error 403 Forbidden?

I could add the 403 header, but then the other URL's stop working.

 

Thank you in advance.

Edited by Badchip
Link to comment
Share on other sites

Presumably the 403 happens because the web server isn't in Spain. If you're checking the URL with PHP then it's checking from the web server IP address.

 

The web server is located in Amsterdam, Netherlands.
Do you know any alternative in order to skip this error? the only guy who answered my previous messages is you. :)
Edited by Badchip
Link to comment
Share on other sites

If that service is using geofencing then you need to either locate the server where they want you to, or convince them to disable geofencing.

 

No other way to detect the URL? (without headers 200|301|302|403 etc.)

Edited by Badchip
Link to comment
Share on other sites

If the server is always going to respond with a 403 if the request doesn't come from the correct country, then you have to send requests from the country they want you to. Maybe you can use a proxy in that country, but that's not all that different from just hosting your server in that country.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...