How do I track the route to my destination page from various 301s?

谁说我不能喝 提交于 2019-12-11 14:18:24

问题


Simple question for someone who might know, the most difficult thing in the world for me:

There's this url: http://hstgb.tradedoubler.com/file/118779/banners/searchboxes/holidays_search_8Sep09.html?url=http://clkgb.tradedoubler.com/click?p=118779&a=1868402&g=18436588

It's an affiliate url (I'm not trying to get you to buy anything ;) )

Now when I click search, it takes me to an intermediary page, which then sends parameters to lastminute to open the destination page.

The second page goes so quickly that I cannot view it or anyhow read it's source code. How do I track the page and parameters sent?


回答1:


You could use a packet sniffer such as Wireshark or a browser add-on that monitors network traffic, to capture every request that gets send and every page that gets received.




回答2:


Well, I wrote a little python to find out.

import urllib

def make_request(url, method='GET'):
    protocol, hostpath = urllib.splittype(url)
    if hostpath[:2] != '//':
        hostpath = '//' + hostpath
    host, path = urllib.splithost(hostpath)
    if len(path.strip()) == 0 or path[0] != '/':
        path = '/' + path
    query = "%s %s HTTP/1.1\r\nHost: %s\r\n\r\n"%(method, path, host)
    if protocol != 'http' and protocol is not None:
        raise ValueError, 'Invalid protocol specified.  http only'

    addresses = socket.getaddrinfo(host, 80)
    return (addresses, query)


def do_request(addresses, query):
    sock_type = addresses[0][:3]
    addr = addresses[0][4]
    connection = socket.socket(*sock_type)
    connection.connect(addr)
    connection.sendall(query)
    return connection

def urlpeek(url):
    return do_request(*make_request(url))

When I perform a peek on the address you give, it looks like the server is actually returning a 200 OK response, which consists mainly of javascript...



来源:https://stackoverflow.com/questions/4319855/how-do-i-track-the-route-to-my-destination-page-from-various-301s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!