[Dead]How to successfully POST to an old ASP.NET site utilizing Asynchronous Postback

grox

New Member
[Update] Unfortunately I never had an opportunity to solve this problem. However, there are some interesting responses below that are worth a try for other readers looking to do something similar.I'm trying to parse data from a site running ASP.NET. This site has a login page that I've successfully traversed (using a legitimate account) and stored the cookie for, but when I get deeper into the site I need to navigate it by updating UpdatePanels via Asynchronous Postbacks. The UpdatePanels contain the data that I want.I'm trying to do this all using PHP and curl. I can successfully load the initial page. When I POST to my target page with all the relevant data (obtained via Firefox's Tamper Data plugin), the echoed result returned from curl always clears my page. Typically, echoing the result would just print out (or spew some error/garbled text) further down the page. curl_error() doesn't print out anything, so it's something wrong with what's being returned to me.I'm at wits end about how to go about this from here. Please tell me if: a) you know what error I'm getting, b) if this is even going to be possible with exclusively PHP, and c) if, conversely, I need to brush off javascript to interact with ASP.NET's UpdatePanels.\[code\]$uri = "TARGETURL";$cl=curl_init();curl_setopt($cl, CURLOPT_URL, $uri);curl_setopt($cl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0');curl_setopt($cl, CURLOPT_COOKIEFILE, "/tmp/cookie2.txt");curl_setopt($cl, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($cl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($cl, CURLOPT_CONNECTTIMEOUT, 0);curl_setopt($cl, CURLOPT_POST, 1);$postdata=http://stackoverflow.com/questions/8283459/array("__VIEWSTATE" => $viewstate, "OTHER DATA" => "asdfkljsddflkjshdjf", "__ASYNCPOST" => "true",);echo "<PRE>";print_r($postdata);echo "</PRE>";curl_setopt ($cl, CURLOPT_POSTFIELDS, $postdata);$result = curl_exec($cl); // execute the curl commandecho $result;\[/code\]Here is the Header and Body I am receiving back from the server (e-mailed to myself to bypass the page-clearing happening with the echo statement):\[code\]HEADER RESPONSE: HTTP/1.1 100 Continue HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Type: text/plain; charset=utf-8Expires: -1 Server: Microsoft-IIS/7.5 X-Content-Type-Options: nosniffSet-Cookie: culture=en-US; expires=Tue, 27-Nov-2012 20:02:37 GMT; path=/ X-Powered-By: ASP.NET Date: Mon, 28 Nov 2011 20:02:37 GMTContent-Length: 112 BODY RESPONSE: 69|dataItem||<script type="text/javascript">window.location="about:blank"</script>|11|pageRedirect||/Error.aspx|\[/code\]This explains the problem I'm getting with the page going blank (javascript redirecting my browser output). It also seems to indicate that the header isn't the issue as I'd be getting an HTTP error from bad header values.
 
Top