Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Start torrent downloads from an iPhone iOS devices
I have a server that I use for, among other things, downloading files with bittorrent. I usually start these torrents by downloading them on my primary computer and then dropping them onto an alias to my server's torrents folder, which my bittorrent client (Transmission) monitors so that it can start the torrents automatically. I occasionally wanted to use my iPod Touch to start these torrents, but Mobile Safari refuses to download torrent files.

My solution was to use Javascript to alter the torrent link to send its URL to my server for download rather than trying to open it. A PHP script on the server could then download that URL to the torrents folder. With both scripts in place, and the permissions of the torrents folder modified to allow Apache to write files, all I have to do is run the Javascript as a bookmarklet before clicking the torrent link, and click the link to download the torrent file. The modified link will pass this URL to the script to download it on the server.

Bookmarklet:
function%20torrent()%20%7Bwindow.location.href%20=%20%22http://torrent.server.address/t.php?%22%20+%20this.href;%20return%20false;%7D;%20for%20(link%20=%200;%20link%20%3C%20document.links.length;%20link++)%20document.links%5Blink%5D.onclick%20=%20torrent;">torrent
PHP:
<?php
if (!($_SERVER['PHP_AUTH_USER'] == "username" && $_SERVER['PHP_AUTH_PW'] == "password")) {
 header('WWW-Authenticate: Basic realm="torrent"');
 header('HTTP/1.0 401 Unauthorized');
} else {
 passthru('curl -H "Referer: '.$_SERVER['$HTTP_REFERER'].'" -H "User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-us) AppleWebKit/523.10.3 (KHTML, like Gecko) Version/3.0.4 Safari/523.10" -o /path/to/monitored/torrents/folder/remote.torrent "'.$_SERVER['QUERY_STRING'].'"');
}
?><script type="text/javascript">history.back()</script>
Modifications required:
  • Script URL in bookmarklet
  • username in php script
  • password in php script
  • /path/to/monitored/torrents/folder path in php script
There are a few issues, like the fact that some torrent sites don't use standard links for their torrents, and I will probably update the scripts in this entry in my hacks blog.
    •    
  • Currently 2.08 / 5
  You rated: 5 / 5 (13 votes cast)
 
[44,564 views]  

Start torrent downloads from an iPhone | 6 comments | Create New Account
Click here to return to the 'Start torrent downloads from an iPhone' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Start torrent downloads from an iPhone
Authored by: fordred on Dec 28, '07 08:50:28PM
Nice tip here. I had trouble setting this up, but I think the following may help.
Firstly, enable php on your mac. The following page helped me with that.
http://mymacinations.com/2007/10/28/apache-php-and-mysql-on-leopard/

Secondly, Choose your torrent folder carefully. Permissions must be set correctly. To avoid hassle, I used my Drop Box. If you do use your Drop Box, it's worth remembering that you should enter ".../Drop\ Box/..." in the settings.

Thirdly, make sure Transmission trashes the torrent file once its picked it up.

On a side not, can I ask why you have the Referral code in there? I changed it match that of my iPhone but even then, I could still use Leopard safari to download the torrent with.

[ Reply to This | # ]
Start torrent downloads from an iPhone
Authored by: hzc on Dec 31, '07 05:15:54AM

Or you can use Clutch (http://clutchbt.com/) which uses Transmission under the hood. Then you'll have a web interface. I've not tested this on my iPhone, but it works very well in the desktop version of Safari.

If you have a domain name set up to hit your server/desktop and open up your router appropriately, you can do this while "on the road".



[ Reply to This | # ]
Start torrent downloads from an iPhone
Authored by: svenbox on Jan 23, '08 03:18:04PM

I got this working after some fiddling around, but for me many torrents didnt work because of weird characters in the file names. This was solved by adding -g after curl in the PHP script. See curls documentation if you wanna know more.

This bookmarklet in combination with Clutch gives me full control over Transmission at my home computer from my iPhone!!! Thanks!!



[ Reply to This | # ]
Start torrent downloads from an iPhone
Authored by: jakdominance on Jan 04, '09 08:42:31PM

what is the exact method of the actual download of the torrent from the iPhone? it seems a little ambiguous.



[ Reply to This | # ]
Start torrent downloads from an iPhone
Authored by: kentyman on Jan 25, '09 09:26:09PM
Start torrent downloads from an iPhone
Authored by: hakunam on Apr 18, '11 02:46:29AM

Great i will burn my iphone downloading stuff...From BTscene



[ Reply to This | # ]