What are the variables being sent by POST here
I've this page: http://www.tataphoton.com/customer-service.aspx
I select the 开发者_运维技巧first option from the first combo: "Photon Pro" then press Go Then I select the first city: Ahmedabad
Now it shows the customer care details.
This same data I'd like to fetch by sending POST request pro-grammatically.
I see that following variables are being sent to the server( I got it from Firebug->Net tab):
- comGetvalue => 'Photon Pro',
- __EVENTARGUMENT=>'',
- __LASTFOCUS=>'',
- comState_city => 'Ahmedabad',
- __EVENTTARGET=>'comState_city',
- __EVENTVALIDATION=>'Very Long String' ,
- __VIEWSTATE=>'Long String'
The above code shows the name=value pairs ( as in my perl code). But the server is not sending the correct response. Am I missing any post variable which is not being sent?
I've added javascript and firebug as tags because those people can easily find out any missing value which I'm not sending just by seeing the html code.
First, is the request you are forming coming from the site to which it is going (Is this a cross-site request)?
Second, you are trying to send a copy of the VIEWSTATE
to the server, it will not work. The view state is a specially encrypted string which contains all of the state information, cookies, etc. about the current page and will change with every load. Any attempts to post this back using some other method will be rejected by the server.
Is it not likely that the __EVENTVALIDATION
and __VIEWSTATE
are significant? Further, given the field names, is it not likely that those values are derived per session to prevent external access?
If you are not getting response you expect, I would first examine the nature of your request - my guess is that you are trying to "cut in" on the middle of a process which has been designed to require that you start from the beginning. Thus, you will probably have to walk your curl requests through the process from the start - first request the initial page (with cookies enabled) to establish a session ID, then send the request to "select" the first combo's value, then another to select the city.
精彩评论