Is ASP.NET the equivalent of this PHP code?

Do we have a flash developer that uses calls to the proxy.php file using querystring? url = "http: // feedburner / whatever" to access external data from rss channels from domains that are by default inaccessible from swf code. for example, I could have the following in the browser: http: //localhost/proxy.php? url = feedburner.com / a_feed , and the browser will display the page as if I placed the feedburner URL directly in the address bar of the browser. The PHP code in this proxy.php file is given below.

$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($post_data);

$ch = curl_init( $_GET['url'] ); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

if ( strlen($post_data)>0 ){
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}

$response = curl_exec($ch);     

if (curl_errno($ch)) {
    print curl_error($ch);
} else {
    curl_close($ch);
    //$response=split("iso-8859-2",$response);
    //$response=join("UTF-8",$response);
    print $response;
}

, - asp.net. PHP , , . , , asp.net, , Google XmlTextWriter ashx, . ?

, response.redirect , , .

PHP- ASP.NET?

+3
2

, , CURL, HTTP ( ), , . , HTTPWebRequest. :

http://support.microsoft.com/kb/303436

+2

, - , , (, , ...):

protected void Page_Load(object sender, EventArgs e)
{
    string URL = "http://feeds2.feedburner.com/the-foreigner";
    HttpWebRequest HttpWRequest = (HttpWebRequest)WebRequest.Create(URL);
    HttpWebResponse HttpWResponse = (HttpWebResponse)HttpWRequest.GetResponse();

    //Read the raw HTML from the request
    StreamReader sr = new StreamReader(HttpWResponse.GetResponseStream(), Encoding.ASCII);
    //Convert the stream to a string
    string s = sr.ReadToEnd();
    sr.Close();
    Response.Write(s); 
}
+1

Source: https://habr.com/ru/post/1733941/


All Articles