Download files through a firewall

From PlainOldWebserver

Jump to: navigation, search

Another Gift from Dave -- How to download files from behind a proxy with xulrunner Pow.


Note if you are using the addon version it takes the settings from Firefox so you don't need this extra code.



<?sjs


var prefs = pow_get_prefs_service();

prefs.setCharPref("network.proxy.no_proxies_on", "localhost,127.0.0.1");

prefs.setBoolPref("network.proxy.share_proxy_settings",false);

//  replace  YOURPROXYNAME  with your proxy's name

prefs.setCharPref("network.proxy.socks","YOURPROXYNAME");

//  replace  80  with your proxy's PORT

prefs.setIntPref("network.proxy.socks_port",80);


prefs.setIntPref("network.proxy.type", 1);

prefs.setIntPref("network.proxy.socks_version", 4);

prefs.setBoolPref("network.proxy.socks_remote_dns",false);


fileurl = "http://davidkellogg.com/";

// load the content or the file or url into "contents"

var contents = pow_file(fileurl)


?>


<html>
<body>
<blockquote>
<h3>The Contents of <a href="<?sjs  document.write(fileurl);
?>"><b><?sjs  document.write(fileurl);   ?></b></a>   are below</h3>

<hr>

<?sjs  document.write(contents);   ?>

</blockquote>
</body>

</html>

Personal tools
Navigation