Translate javascript code to c# - help is needed -


I have a Windows application that is using .net4

I'm getting data from "WarGaming.Net" "API".

I get much data from HTTP WebHive and HTTP Web Response Classes.

My URL is Requested ""

But I get "403 Prohibited".

I read about how to do this post with a JavaScript script

  function getResp ($ parr) {$ ch = curl_init ()); Curl_setopt ($ c, CURLOPT_URL, "http://cw.worldoftanks.eu". $ Parr); Curl_setopt ($ CH, CURLOPT_VERBOSE, 0); Curl_setopt ($ CH, CURLOPT_HEADER, 0); Curl_setopt ($ CH, CURLOPT_USERAGENT, "Mozilla / 4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('Accept: Application / Jason, Text / Javascript, Text / HTML, * / *', 'With X-Requested: XMLHttpRequest')); Curl_setopt ($ CH, CURLOPT_REFERER, "http://worldoftanks.eu/"); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); $ Response = curl_exec ($ ch); $ C_type = curl_getinfo ($ ch, CURLINFO_CONTENT_TYPE); If (curl_getinfo ($ CH, CURLINFO_CONTENT_TYPE) == 'Image / JPEG') {$ response = array (); $ Response ['request_data'] ['error_message'] = w2u ('site may return JPEG, manetens?'); $ Response = json_encode ($ response); } Curl_close ($ ch); $ Refund; } Print_r (getResp ('/ clanwars / maps / province / regions / 1 /? Ct = json')); 

Div>

This is a part of PHP scripting which uses the curl library which requests a server with a specific header and a series of values.

Would you like to use .NET equiv, WebRequest: and take a look at more examples of implementation.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -