-
Posts
52 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Badchip
-
-
I'd like to load a live DASH stream (.mpd) with a license from Google Chrome.
Recently I could do it using JW Player but now there is a CORS protection (however it works using a HLS + DASH Player Chrome extension)My question is: How to load the 2 URL's together without JW Player?
This is the JW Player code:
<script> var playerInstance = jwplayer("player"); playerInstance.setup({ playlist: [{ "sources": [{ "file": "//stream.com", "drm": { "widevine": { "url": "//license.com" } } }] }], }); </script>
Thank you in advance.
-
Suppose that 100 visitors run the same PHP at the same time (which contains the file_get_contents to get the code of another page)
I'd like to allow only 1 request at a time. That code will be sent via file_put_contents (to a .txt file) so that other users can access it.
I want to prevent the other website from registering 100 hits in a second. -
I want to avoid file_get_contents from being executed multiple times at once.
For example, if 100 visitors access a PHP at the same time, I want the file_get_contents to be executed only 1 time.Thank you in advance.
-
Now I'm trying to access a website with a cookie but I can't access the content.
Is this code correct?<script> var myInit = { cookie: 'SID=1234567890', }; function file_get_contents(filename) { fetch(filename, myInit).then((resp) => resp.text()).then(function(data) { url = JSON.parse(data); location.replace(url['src'], myInit); }); } file_get_contents('https://site.com/file.php') </script>
Thank you again.
-
I have replaced "// Do something with the data here" with "return data;" but I get a blank page.
What should I put to see the result?By the way, can I send the content to a text file?
Thank you for your help.
-
Why can't I get the contents of this?
<script> function file_get_contents(filename) { fetch(filename).then((resp) => resp.text()).then(function(data) { return data; }); } file_get_contents('https://mediainfo.tf1.fr/mediainfocombo/L_LCI?context=MYTF1&pver=4014002'); </script>
-
I know some websites have CORS enabled but I'm not sure if this link have CORS too https://www.sony.com/en/top/2021/js/news.js
-
So there is no other way to get the content from JS?
-
Based on this tutorial (https://lage.us/Javascript-File-Get-Contents.html) I can't get this to work with JS (like PHP) just get a blank screen:
function file_get_contents(filename) { fetch(filename).then((resp) => resp.text()).then(function(data) { return data; }); } file_get_contents('https://www.sony.com/en/top/2021/js/news.js');
I have no problems with PHP:
<?php $url = file_get_contents('https://www.sony.com/en/top/2021/js/news.js'); echo $url;
Any idea? thanks in advance.
-
Then I just need to change the PHP name periodically & automatically.
-
It's to avoid that the PHP path can be used by anyone. What I want to do is change the PHP name often automatically.
I want it to change every time I run PHP. -
I'm trying to protect a php file to prevent it from being used frequently outside of my web. My idea is to rename it with a 4-digit pin using the code: $pin = mt_rand (1000, 9999);
... but I don't know how to rename the old file/pin with the new one: rename ("old", "new"); ???Any help will be welcome.
-
I have solved it. Thank you.
$url = file_get_contents('http://web.com'); $url = get_string_between($url, '"file": "http://', '"'); if (empty($url)) $url = file_get_contents('web_url.txt'); else file_put_contents('web_url.txt', $url); header("Location: http://$url");
-
I think it's almost done. Now I need to skip the 'fopen' and 'fwrite' lines if there are no results between '"file": "http://', '"');
$url = file_get_contents('http://web.com'); $url = get_string_between($url, '"file": "http://', '"'); $file = fopen("web_url.txt", "w"); fwrite($file, $url); $file = file_get_contents('web_url.txt'); header("Location: http://$file");
Any idea?
-
I want to obtain a URL of a website (it's inside the HTML) and add the URL in the same PHP.
-
I want to get the url from another site and put it in my php. Something like this:
$url = file_get_contents('http://...'); $url = get_string_between($url, 'http://...', '"'); $fopen($url, 'w'); fwrite($url); fclose() header("Location: http://result.here");
If it is not possible, what other alternative do I have?
-
403 Forbidden
in PHP
I get a "430 Forbidden" error from Android/iOS when I click "TEST": http://ver.hol.es
However if I click the URL in the address bar (after the error) and then I hit ENTER... it works.
Where is the problem? is there any way to paste an URL and hit enter with PHP? (instead the header)
-
18 hours ago, justsomeguy said:
I'm almost positive that the reason you can't view the stream is because now the browser thinks everything is coming from your server, but the stream is not on your server. If you open the actual .m3u8 file and look at the contents of it, notice the URLs do not have domain names or anything else. All of those are relative URLs. Your browser or whatever you're opening that file with is probably looking for those files on your server.
I'm just trying to open this stream from PHP, without changing the URL of the browser.
In other words, I want to hide the stream in PHP. (show "stream.php" instead http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8)
PS: I use Native HLS Playback to play m3u8 directly from Chrome.
-
40 minutes ago, justsomeguy said:
If you don't want to just print the contents of the file then you need to send the correct headers to tell the browser how to use it. If you just want the browser to download and save that file then the headers you need to send are a content-type header with the correct MIME type for a .m3u8 file, and maybe a content-disposition header. Start by looking up the MIME type for that file and sending the content-type header.
Although I'm wondering why you're trying to use PHP to proxy a stream. I don't think that's going to work, it looks like those URLs are relative and they are not on your server. If your server is not a streaming server then why point your browser to your server instead of where the actual stream is?
I already tried just what you say to download and save that file: http://int.hol.es/test2.php
header('Content-type: application/x-mpegURL'); header('Content-Disposition: inline; filename="video.m3u8"'); readfile('http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8');
However I can't open the stream; just view the content or download the file.
The only way I know is using "header" ... but it changes the URL.Please, can someone show me an example for this?
-
On 29/11/2017 at 1:29 AM, justsomeguy said:
No, this is just one piece of code. Sending a location header tells the browser to redirect. If you don't want the browser to redirect, then don't send a location header. Instead, you can use PHP to just get the contents of the other file (e.g. using file_get_contents) and output that. This is assuming that you just want to display the information in the browser. If you want to prompt the user to download and save the data then there are some other headers you could use for that.
I have not been able to solve this problem. I would appreciate any example instead of explanations.
I have found another way to access a file without changing the URL namereadfile('http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8');
However it displays the code: http://int.hol.es/test.php
Please can you help me with a simple example?
-
Solution: miniProxy
-
Well, then there is some alternative for this, right?
-
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. -
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?
Any way to get the URL with this code?
in Java/JSP/J2EE
Posted
I'm trying to get the live stream (.mpd) URL using "File_Get_Contents" with JS but I get a "304 Not Modified" status code.
Is there any way to get it or it's not possible? I can do it with PHP but then the url only works locally.
Thank you in advance.