Badchip Posted November 10, 2017 Share Posted November 10, 2017 This URL opens a ".m3u8" stream: http://link.theplatform.com/s/pf1NfC/9buCiIMqXE9z I'd like to extract the URL (via PHP) Thank you in advance. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 10, 2017 Share Posted November 10, 2017 The easiest way is to use file_get_contents to get the contents of that file as long as your server is configured to allow that. Link to comment Share on other sites More sharing options...
Badchip Posted November 10, 2017 Author Share Posted November 10, 2017 (edited) I tried with: <?php echo file_get_contents("http://link.theplatform.com/s/pf1NfC/9buCiIMqXE9z"); ?> but I obtain the contain of the stream, not the URL: #EXTM3U #EXT-X-VERSION:3 #EXT-X-INDEPENDENT-SEGMENTS #EXT-X-STREAM-INF:BANDWIDTH=1100000,AVERAGE-BANDWIDTH=1100000,CODECS="avc1.77.30,mp4a.40.2",RESOLUTION=768x430,FRAME-RATE=29.970 master1000k.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=2420000,AVERAGE-BANDWIDTH=2420000,CODECS="avc1.4d401f,mp4a.40.2",RESOLUTION=1280x720,FRAME-RATE=29.970 master2500k.m3u8 #EXT-X-STREAM-INF:BANDWIDTH=550000,AVERAGE-BANDWIDTH=550000,CODECS="avc1.4d4015,mp4a.40.2",RESOLUTION=480x270,FRAME-RATE=29.970 master500k.m3u8 I just need the second URL than opens http://link.theplatform.com/s/pf1NfC/9buCiIMqXE9z Edited November 10, 2017 by Badchip Link to comment Share on other sites More sharing options...
justsomeguy Posted November 10, 2017 Share Posted November 10, 2017 That text is exactly what is inside that file. If you open it with a text editor you'll see that. If you don't want the contents of the file, what do you want? Link to comment Share on other sites More sharing options...
Badchip Posted November 10, 2017 Author Share Posted November 10, 2017 I just want the URL of the stream (http://stream.m3u8...") when you click http://link.theplatform.com/s/pf1NfC/9buCiIMqXE9z Link to comment Share on other sites More sharing options...
Badchip Posted November 10, 2017 Author Share Posted November 10, 2017 (edited) I want to copy the code after ".m3u8?" in order to use it with another stream. ?hdnea=st=1510277838~exp=151027.................. Is it possible? Edited November 10, 2017 by Badchip Link to comment Share on other sites More sharing options...
justsomeguy Posted November 10, 2017 Share Posted November 10, 2017 That server is redirecting one URL to another, it sounds like you want the URL that it redirects to. You might need to use a library like cURL to send a request to that URL and get the headers back. The redirection URL will be in the Location header. 1 Link to comment Share on other sites More sharing options...
Badchip Posted November 10, 2017 Author Share Posted November 10, 2017 I found the solution here https://stackoverflow.com/questions/9020592/how-to-get-the-url-of-a-download-link Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now