c000kie Posted October 24, 2007 Share Posted October 24, 2007 Tried using fsockopen but I don't really know what to send, anybody has some knowledge about this? I've also tried to look trough some "php bittorrent clients" but in fact they're not clients they're just php interfaces to clients written in python. THANKS alot Quote Link to comment Share on other sites More sharing options...
Azu Posted October 24, 2007 Share Posted October 24, 2007 You could try looking at what the python code sends and have your PHP code send that? Quote Link to comment Share on other sites More sharing options...
c000kie Posted October 25, 2007 Author Share Posted October 25, 2007 Well, problem is I tried that, but it's not that easy to understand..I mean I know some PHP, but @ python I really suck, they're not very different from one another but still.. Thing is on the BitTorrent Wiki (http://wiki.theory.org/index.php/BitTorrentSpecification#Handshake) they say when the handshake (connection between peers) is something like: The handshake is a required message and must be the first message transmitted by the client. It is (49+len(pstr)) bytes long. handshake: <pstrlen><pstr><reserved><info_hash><peer_id> * pstrlen: string length of <pstr>, as a single raw byte * pstr: string identifier of the protocol * reserved: eight ( reserved bytes. All current implementations use all zeroes. Each bit in these bytes can be used to change the behavior of the protocol. An email from Bram suggests that trailing bits should be used first, so that leading bits may be used to change the meaning of trailing bits. * info_hash: 20-byte SHA1 hash of the info key in the metainfo file. This is the same info_hash that is transmitted in tracker requests. * peer_id: 20-byte string used as a unique ID for the client. This is usually the same peer_id that is transmitted in tracker requests (but not always e.g. an anonymity option in Azureus). In version 1.0 of the BitTorrent protocol, pstrlen = 19, and pstr = "BitTorrent protocol". Thing is I will find the info_hash in a MySQL database and the peer_id will be some fixed value taken from a client, how do I send this and all the rest? How would the syntax look like? Quote Link to comment Share on other sites More sharing options...
Azu Posted October 25, 2007 Share Posted October 25, 2007 Then post the python here so one of us can help you translate it. Quote Link to comment Share on other sites More sharing options...
tibberous Posted October 25, 2007 Share Posted October 25, 2007 Why don't you just use the command line bit torrent client with PHP? That would be a lot easier, unless you are trying to modify the innerworkings of the client? Quote Link to comment Share on other sites More sharing options...
c000kie Posted October 25, 2007 Author Share Posted October 25, 2007 Yea' that's what I'm trying to do.. because I don't really need to use it as a client but as a peer connector to verify if there really is a peer at that given IP address. (best solution against fakers that I could think at) The python code is very large.. that's why I'm having trouble with understanding it.. Here is torrentflux: http://tf-b4rt.berlios.de/ The most popular PHP(interface) client. Quote Link to comment Share on other sites More sharing options...
c000kie Posted October 26, 2007 Author Share Posted October 26, 2007 i'm doomed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.