EVENTVALIDATION error while scraping asp.net page

你离开我真会死。 提交于 2019-12-04 17:18:29
user2047731

you have to get and pass the __VIEWSTATE and __EVENTVALIDATION variables in one session call, otherwise when doing the second POST call while reopening connection to the server it expects to receive back already another __VIEWSTATE and __EVENTVALIDATION!

So basically the logics should be as follows:

  • curl_init()
  • curl GET __VIEWSTATE and __EVENTVALIDATION
  • *some logics here *
  • curl POST parsed out __VIEWSTATE and __EVENTVALIDATION
  • * some logics here *
  • curl_close();

Try to add __REQUESTDIGEST form field, it is a validation field used by Sharepoint. Also, add name of the select element with states as the value of __EVENTTARGET field:

__EVENTTARGET   ctl00$ctl25$g_4828177f_5427_4b0f_a968_ad02dc3674ec$ctl01$ddlState
__REQUESTDIGEST 0xDF6A6E14C550004C4A8533A9F5D...,14 Jun 2012 10:13:34 -0000
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!