Jump to content
Sign in to follow this  
Badchip

Stream not working using PHP...

Recommended Posts

I'm trying to access a public spanish sports channel (with geoblock), via PHP.

http://api.goltelevision.com/api/v1/media/hls/service/live

It contains:

{"code":200,"message":{"success":{"license":"","ip":"XX.XX.XX.XXX","manifest":"http://api-cdn.overon.es/SmilLive/getLiveIOS/playlist.m3u8?system=webgol&stream=webgol_gol24h&token=47836b419952abb5a0a768999ff9fb87&expire=5a503f1c","customData":"","hash":"webgol_gol24h","type":null}}}

If I copy/paste the URL (http://...), it opens the stream without problems. However if I extract the URL via PHP (using "extract_unit" function) it does not open.

Any idea?

Edited by Badchip

Share this post


Link to post
Share on other sites

There is no built-in function called "extract_unit" so my first question would be if you're even getting the URL correctly.  That's a JSON response, so why not just decode it and access that item directly?

Share this post


Link to post
Share on other sites

It's the function name that I'm using in order to extract the URL.
Anyway I think the problem is the IP associated. It's using the host IP instead the local IP.
Is there any way to get the URL using the local IP via PHP?

Edited by Badchip

Share this post


Link to post
Share on other sites

It's the function name that I'm using in order to extract the URL.

That's fine, but just telling us whatever you named the function without showing what it's actually doing doesn't provide any information.  I doubt the problem is the name you chose for the function.

Anyway I think the problem is the IP associated.

Why do you think that's the problem?

Is there any way to get the URL using the local IP via PHP?

You mean the IP of the client using your website instead of the server?  It will be in the $_SERVER array, but PHP is still going to send the request using the server's IP.  Maybe you can specify an IP address in the request and PHP can send the client's address though, I'm not familiar with the service you're using.

Share this post


Link to post
Share on other sites
3 hours ago, justsomeguy said:

You mean the IP of the client using your website instead of the server?  It will be in the $_SERVER array, but PHP is still going to send the request using the server's IP.  Maybe you can specify an IP address in the request and PHP can send the client's address though, I'm not familiar with the service you're using.

Please open this website + view the source: http://www.latina.pe/tvenvivo (search for "m3u8" URL... you will see your dinamic IP)

My question is: can I extract the URL using my dinamic IP?
I tried to extract the URL using PHP... however it shows the host IP, not my dinamic IP.

Share this post


Link to post
Share on other sites

My question is: can I extract the URL using my dinamic IP?

Not with PHP, because PHP runs on the web server, not your computer.  PHP can't directly interact with your computer, it can't send a request using your IP address.  You can replace the IP with yours, but I bet that's going to break the token.

Share this post


Link to post
Share on other sites

If you want to send requests with your IP address then you need to do it in the browser, for example with Javascript.  I don't know if that's going to help in your particular situation or not, for example you wouldn't be able to send an ajax request to their site unless they allowed it, but if you want to use your own IP then it needs to come from your computer.

Share this post


Link to post
Share on other sites

Depending on what you're trying to do, you might also be able to do everything in PHP and just have PHP act as a proxy.  So you wouldn't tell the browser to load that stream, PHP would load it and maybe just pass everything through to your browser.

Share this post


Link to post
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
Sign in to follow this  

×