Get data from a ASP page using Php

elaclemaymn

New Member
I am trying to get data from the below url But I have been unsuccessful.I have read a lot about Viewstate but I am unsuccessful in getting this to work..Whenever I execute this I get no data but I am not getting any errors.http://agmarkweb.dacnet.nic.in/SA_Pri_MonthRep.aspx';\[code\] $fields = array( 'Year_list'=>urlencode("2013"), 'Month_list'=>urlencode("2"), 'Commodity_list'=>urlencode("40"), '__EVENTTARGET'=>(""), '__EVENTARGUMENT'=>(""), '__LASTFOCUS'=>(""), '__VIEWSTATE'=>("")); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch, CURLOPT_VERBOSE, false); curl_setopt($ch, CURLOPT_HEADER, CURLOPT_ENCODING); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U;Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); //execute post $result = curl_exec($ch); echo $result; //close connection curl_close($ch);\[/code\]I read a lot about View state but what should be done in this case? Whether I should just copy the Viewstate into my code?
 
Top