javascript - PHP Curl and ajax query to ASP.NET page -


i trying send ajax query asp.net page.

algorithm:

1. have form on page; 2. when user filled fields clicks submit button; 3. when submit button clicked js send ajax request page on server (test.php) 4. test.php sends request page on other server (asp.net). (page results in text/palin if right post fields sended) 5. test.php echo result , js callback alert result; 

i know client side code working server side... code of server side:

define('posturl', 'http://nakolesah.ru/'); define('postvars', 'ctl00%24sm=ctl00%24contentplaceholder%24upnlfilterauto%7cctl00%24contentplaceholder%24ddlsizevendorsauto&__eventtarget=ctl00%24contentplaceholder%24ddlsize...  $ch = curl_init(posturl); curl_setopt($ch, curlopt_post      ,1); curl_setopt($ch, curlopt_postfields    ,postvars); curl_setopt($ch, curlopt_followlocation  ,1);  curl_setopt($ch, curlopt_header      ,0);  // not return http headers  curl_setopt($ch, curlopt_returntransfer  ,1);  // return contents of call curl_setopt($ch, curlopt_referer, posturl); curl_setopt($ch, curlopt_httpheader, array('x-requested-with: xmlhttprequest', 'x-microsoftajax: delta=true', 'host: nakolesah.ru', 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'content-type: application/x-www-form-urlencoded; charset=utf-8', 'connection: keep-alive')); $rec_data = curl_exec($ch); echo $rec_data; die(); 

(request must imitate ajax request)

result now:

1|#||4|58|pageredirect||%2fgenericerrorpage.aspx%3faspxerrorpath%3d%2fdefault.aspx|

it seems error, coz normal result must give html-list.

i copied post , header data of httpfox.

i tried absolutely imitate browser when browser cookies off:

curl_setopt($ch, curlopt_httpheader, array('host: nakolesah.ru',                                                'user-agent: mozilla/5.0 (windows; u; windows nt 6.1; uk; rv:1.9.2.13) gecko/20101203 firefox/3.6.13 webmoney advisor',                                                'accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',                                                'accept-language: uk,ru;q=0.8,en-us;q=0.5,en;q=0.3',                                                'accept-encoding: gzip,deflate',                                                'accept-charset: utf-8,*',                                                'keep-alive: 115',                                                'connection: keep-alive',                                                'x-requested-with: xmlhttprequest',                                                'x-microsoftajax: delta=true',                                                'cache-control: no-cache, no-cache',                                                'content-type: application/x-www-form-urlencoded; charset=utf-8',                                                'pragma: no-cache')); 

and it's doesn't working :(

any idea sending ajax request asp.net page of php curl?

sending requests asp.net page or asp.net webservice no problem, there, allowed. seems me want html content of updatepanel. security of asp net updatepanels not unbreakable, absolutly not designed copied other websites. never tried, think not reach goal. asp net generating viewstate, encrypted, , ajax request, uses viewstate validate request. not able reproduce viewstate field, needed making updatepanel work.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -