Hello fellow stackoverflow'ers!
Today I was tired of old dead links to my fav internet radio, so I decided to make a downloader for all channels from di.fm. The idea was simple: download the page, get to the menu and parse it. After that create a playlist and make user download it.
So I created a PHP script as an API for my JS script. PHP functions were to download the page (JS cannot really do that), save playlist sent via POST in cookies and to provide it as a file. Cookies are supposed to be a communication channel between JS and PHP (with POST I cannot really make file download itself).
So far so good. Everything works like a charm under Opera. Things are getting complicated in Chrome and Firefox. Chrome reloads the page without a download dialog, Firefox works about the same, just sometimes lets me download the list... that is empty.
Any ideas how to solve it? Here is the code (feel free to use it yourself if you like it):
http://pastebin.com/dcEzxV9w
Thanks in advice,
Dracco
Related
I have searched quite a bit, but all results I find deal with calendar apps, how to register apps as ics file handlers, etc.
Instead, the problem I have is the following:
We have a list of events on our page. We use PHP to dynamically create an *.ics file for each event, so that it can be directly imported into the user's calendar software. This works well with Outlook and on iOS (download prompt on PC so I can open in Outlook, iPhone displays a file symbol and name and gives me an "open in calendar" option), but when I click the link from an Android device (Galaxy S3), the browser just displays the .ics file as raw text, instead of opening it in a calendar or at least letting me download it.
Is there any way to make the browser open the file in the user's calendar or at least download it, so that the user 1) doesn't see ugly text and 2) can import the file using some app of his own? Or is there maybe a different file format that I could use or any other way, so that similar functionality can be achieved?
Requiring the users to change some settings or use this or that app is not really an option, so it would be nice if there was a way to trigger such behaviour just using a link.
Edit: Or, now that I think about it - is there even a standard format that would work across all (or at least most) Android devices? They don't share any standard inbuilt calendar as far as I know, do they?
Update: I have now managed to make it download the file: had an error in my header information (text/x-vCalendar instead of the correct text/calendar), that PC browser and iOS don't seem to notice, but Android did). I then had some parsing error, but that seems to come from empty lines that sometimes got into the files.
Sorry, already got everything working. It was a mixture of my own stupidity and Android being a lot stricter than the other systems.
I have now managed to make it download the file: had an error in my header information (Content type text/x-vCalendar instead of the correct text/calendar), that PC browser and iOS don't seem to notice, but Android did). I then had some parsing error, but that seems to come from empty lines that sometimes got into the files, which neither of the other two systems complained about, so nobody noticed that.
I have audio files saved in a folder on my server. They are called by JQuery JPlayer to be played. However if a person looks at the source of the page, they can find the location of the file and simply download it. I want to protect the files from being downloadable, but still allow JPlayer to play them. Is this possible?
I have tried denying the folder with .htaccess as well as password protecting the folder, but this prevents JPlayer from being able to play the files.
It's impossible to stop a savvy user stealing your media. But if you like, you could
use oAuth to govern access to the media resource
teach your server to only respond to media requests that contain "special" HTTP Headers, Cookies etc.
use DRM (washes mouth out)
some other URL obfuscating/expiring method you dream up..
To save time, i suggest you accept whatever you publish can be copied / taken. So, why not publish
a sample snippet (e.g. the first minute)
A lower-bitrate / mono taster version
Recently, a widget allowing you to stream Paul McCartney's new album was published in the Guardian.. how this is "secure" i don't know, I opened Chrome Dev Tools Network tab and helped myself to anything "audio/mpeg"!
I found a possible answer for you, using PHP:
Solution using PHP sessions
It's a long thread, but there's code there that will help you.
You should be aware (just in case you're not) that if someone can play the file in their browser, there is nothing to stop them playing the file and using recording software to capture the audio.
Is there any way to disable the download dialog box in Firefox, Chrome, IE, etc.. using php?
Because I have a project, its like a file management, where the users (client) will just view the files (.doc, .ppt, .pdf, etc) and they should not be able to download it.
For me, I think it cannot be.. But to you guys I know you have ideas on how to do it. Any suggestion is greatly appreciated..
they should not be able to download it
It does not depend how a browser offers a user-interface for a resource located at an internet-address (URL or URI): Dialog box or view-port - the file is always downloaded.
So the answer is no because a user is always able to download it - as the browser must be able to do so.
I used MS Office itself to convert all my docs to .html extension.. then I upload it to my intranet site.. so my members can only view the information I uploaded.. I used some javascript to disable the right click button so no one can save that file.
I'm working on a portal to a page where customers can see the streaming video of their security cams. I just currently have a page with our logo with an iframe containing the proper surveillance page. It works fine, except for one major problem. If the plugin isn't already installed, it will never prompt to load the H264 Streaming Viewer from AVTECH, as long as its being loaded through an iframe.
Is there anyway around this?
Do they have to be embedded via iframes? You may also consider injecting them via <object> or if they’re supposed to be iframe-dynamic consider using JavaScript to swap/navigate.
If iframe itself does not prompt, there’s no way around that wile using iframes.
You could however add a small or non-visible video to the page with the iframe, so users are asked (are they asked automatically or when starting the video?) when loading the parent page.
I am working on a project and was wondering how the code for downloading video files is like. I have an idea but it is half of the bigger picture.I am coding in php and jquery.
Simply link to them in either PHP or jQuery and then visitor to the site can click to download them; this is complicated by the server/client model of served pages, in that you're trying to get the client to download the videos, not the server.
Also, if their default viewer is something like Windows Media Player, this will manage the downloading for you/them.
Unless you're talking about embedding the video into the page and streaming the content when the page loads, or an event is fired (jQuery, etc)?
Hope this helps.