Jump to content

Badchip

Members
  • Posts

    52
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

2,650 profile views

Badchip's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. 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. <script> function file_get_contents(filename) { fetch(filename).then((resp) => resp.text()).then(function(data) { url = JSON.parse(data); location.replace(url['delivery']['url']); }); } file_get_contents('https://mediainfo.tf1.fr/mediainfocombo/L_LCI'); </script> Thank you in advance.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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>
  8. 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
  9. So there is no other way to get the content from JS?
  10. 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.
  11. Then I just need to change the PHP name periodically & automatically.
  12. 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.
  13. 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.
  14. 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");
  15. 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?
×
×
  • Create New...