How to trigger a smart link?

M

Muddy Coder

Hi All,

Using urllib2 can trigger CGI script in server side. However, I
encountered a problem of the so-called smart link. When a fairly large
site, the server needs to track the identifier of each request from
client, so it generated an ugly escape string attached on url. It
seems that I must get this ugly escape string first then I can can
fill the string into my url, and the CGI script on server side can be
triggered. For example,

http://whatever.com/submitreal.cgi?fp=3xD0TuGMp7C7gP1TRD

displays a submit form. If I just copy

http://whatever.com/submitreal.cgi

to url address, without the escape string ?fp=3xD0TuGMp7C7gP1TRD, the
browser will report error of 404

I found Python has a module of escape, but I don't know how to use
this module to solve the problem above. Or, I just wonder does urllib2
has such a method to handle smart link? Thanks!


Moddy Coder
 
C

Chris Rebert

Hi All,

Using urllib2 can trigger CGI script in server side. However, I
encountered a problem of the so-called smart link. When a fairly large
site, the server needs to track the identifier of each request from
client, so it generated an ugly escape string attached on url. It
seems that I must get this ugly escape string first then I can can
fill the string into my url, and the CGI script on server side can be
triggered. For example,

http://whatever.com/submitreal.cgi?fp=3xD0TuGMp7C7gP1TRD

displays a submit form. If I just copy

http://whatever.com/submitreal.cgi

to url address, without the escape string ?fp=3xD0TuGMp7C7gP1TRD, the
browser will report error of 404

I found Python has a module of escape, but I don't know how to use
this module to solve the problem above. Or, I just wonder does urllib2
has such a method to handle smart link? Thanks!

I think you'll need to fetch whatever webpage contains the link with
the magic URL, and then use an HTML parser (e.g. BeautifulSoup or
lxml) to parse the URL out of the page. Then just fetch the URL you
obtained.
I doubt you can just generate the escape string yourself, you need the
cooperation of the CGI script on the other end; hence the need to
fetch the known page.

Cheers,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top