Frustrated Enthusiast Posted March 19, 2010 Report Share Posted March 19, 2010 I'm working on a script and keep running into a silly issue.When I go to add a magnet link via the WebUI API the magnet link adds successfully but no trackers associated with the torrent show up. The reason is that the tracker information stored in the magnet link is not seen as part of the query being passed to the WebUI API.Say I have the following (bogus, obviously) magnet link:magnet:?xt=urn:btih:a187011af71853cfd9acfacbb9b85a2d06575f39&tr=http://tracker1.com/announce&tr=http://tracker2.com&tr=http://tracker3.comSo I do the following WebUI API call:http://username:password@server/gui/?action=add-url&s=magnet:?xt=urn:btih:a187011af71853cfd9acfacbb9b85a2d06575f39&tr=http://tracker1.com/announce&tr=http://tracker2.com&tr=http://tracker3.comThe WebUI API sees:?action=add-url&s=magnet:?xt=urn:btih:a187011af71853cfd9acfacbb9b85a2d06575f39&tr=http://tracker1.com/announce&tr=http://tracker2.com&tr=http://tracker3.cominstead of the desired behaviour, which is to include the trackers in the "s" query variable.Of course the API's behaviour here is correct and mine is wrong. This is a total brain fart thing, I'm sure I'll figure this out two minutes after I post. I know I've gotta escape or convert those the ampersands somehow. The script I'm writing is in PHP.Can anyone steer me in the right direction? Link to comment Share on other sites More sharing options...
DreadWingKnight Posted March 19, 2010 Report Share Posted March 19, 2010 urlencode the magnet uri before you put it into the webui request maybe? Link to comment Share on other sites More sharing options...
Ultima Posted March 19, 2010 Report Share Posted March 19, 2010 Definitely. Any time a string is sent as a GET parameter, it should to be urlencoded. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.