I'd be willing to pay for a working PHP script that will do the same as this, It's pritty basic, i just cant do it myself. this simply gets the .flv file from a veoh.com video. I need it to work inside an Iframe and outpoot the download link. <script> //<![CDATA[ const ObserverService = Components.classes['@mozilla.org/observer-service;1']; const WebBrowserPersist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]; const LocalFile = Components.classes["@mozilla.org/file/local;1"]; const IOService = Components.classes["@mozilla.org/network/io-service;1"]; const FilePicker = Components.classes["@mozilla.org/filepicker;1"]; const DEBUG = false; function $(id){ return document.getElementById(id); } function PromptSave(){ var filePicker = FilePicker.createInstance(Components.interfaces.nsIFilePicker); filePicker.init(window, "Save File", Components.interfaces.nsIFilePicker.modeSave); filePicker.appendFilter("Flash Video Files (FLV)", "*.flv"); var result = filePicker.show(); if(result == Components.interfaces.nsIFilePicker.returnOK || result == Components.interfaces.nsIFilePicker.returnReplace){ var file = filePicker.file; var filename = file.path; if(filename.substring(filename.length-4).toLowerCase() != ".flv") filename += ".flv"; return filename; }//end if return null; }//end PromptSave() function SaveFile(url, filename){ var persist = WebBrowserPersist.createInstance(Components.interfaces.nsIWebBrowserPersist); var file = LocalFile.createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filename); var uri = IOService.getService(Components.interfaces.nsIIOService).newURI(url, null, null); persist.progressListener = { onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) { var percentComplete = parseInt((aCurTotalProgress/aMaxTotalProgress)*100); $("Status").value = "Downloading " + percentComplete +"%"; $("Progress").value = percentComplete; if(percentComplete == 100) window.close(); }, onStateChange: function(aWebProgress, aRequest, aStatus, aMessage) { // do something } }; $("Progress").mode = "determined"; $("Status").value = "Downloading..."; persist.saveURI(uri, null, null, null, "", file); }//end SaveFile() var bFound = false; var requestObserver = { register: function() { var observerService = ObserverService.getService(Components.interfaces.nsIObserverService); observerService.addObserver(this, 'http-on-modify-request', true); }, observe: function(subject, topic, data){ try{ if(topic == "http-on-modify-request"){ var httpChannel = subject.QueryInterface(Components.interfaces.nsIHttpChannel); var channel = subject.QueryInterface(Components.interfaces.nsIChannel); if(channel){ var url = channel.URI.prePath + channel.URI.path; if(DEBUG) $("Debug").appendItem(url); if(url.indexOf("content.veoh.com") > 0){ if(!bFound){ bFound = true; $("Status").innerHTML = "FLV file found..."; $("URLTarget").parentNode.removeChild($("URLTarget")); subject.cancel(Components.results.NS_BINDING_ABORTED); var filename = PromptSave(); if(!filename) window.close(); SaveFile(url, filename); }//end if }//end if }//end channel }//end if } catch(ex){ }//end tc }, QueryInterface: function(iid){ if ( iid.equals(Components.interfaces.nsIObserver) || iid.equals(Components.interfaces.nsISupportsWeakReference) || iid.equals(Components.interfaces.nsISupports)) return this; throw Components.results.NS_NOINTERFACE; } } requestObserver.register(); window.onload = function(){ var cmdLine = window.arguments[0]; cmdLine = cmdLine.QueryInterface(Components.interfaces.nsICommandLine); var workingDirectory = cmdLine.workingDirectory.path; var url = cmdLine.getArgument(0); if(!url) window.close(); var x = cmdLine.getArgument(1); var y = cmdLine.getArgument(2); window.moveTo(x,y); $("Status").value = "Contacting host..."; $("URLTarget").src = url; }//end startFile() // ]]> </script> <label id="Status" style="text-align: center" /> <progressmeter id="Progress" mode="undetermined" value="0" /> <listbox id="Debug" style="display:none;width:100%;" rows="25" /> <hbox> <html:iframe id="URLTarget" width="100" style="opacity:0;" /> </hbox> </window> Code (markup):
I did search "veoh php download" but all the scripts i found dont work or give a Forbidden. The script i just posted i a part of a desktop addon and it works like magic, just need to convert it to a working php function. Show me love boys