please help turn a simple Python2 code to PHP
Posted
by user296516
on Stack Overflow
See other posts from Stack Overflow
or by user296516
Published on 2010-04-13T15:03:14Z
Indexed on
2010/04/13
15:13 UTC
Read the original article
Hit count: 395
Hi guys, Sorry to bother again, but I really need help transforming this Python2 code into PHP.
net, cid, lac = 25002, 9164, 4000
import urllib
a = '000E00000000000000000000000000001B0000000000000000000000030000'
b = hex(cid)[2:].zfill(8) + hex(lac)[2:].zfill(8)
c = hex(divmod(net,100)[1])[2:].zfill(8) + hex(divmod(net,100)[0])[2:].zfill(8)
string = (a + b + c + 'FFFFFFFF00000000').decode('hex')
data = urllib.urlopen('http://www.google.com/glm/mmap',string)
r = data.read().encode('hex')
print float(int(r[14:22],16))/1000000, float(int(r[22:30],16))/1000000
Would be great if someone could help, thanks in advance!
© Stack Overflow or respective owner