Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get response from php page

I need to call .php page from my aspx.cs page.but I don't want to load the page.I just want to call the page and the page will give me XLM response that I need to store in DB.I am trying this with the Ajax,but according to this link.We are not be able to call cross domain page from ajax.

In short I want to read the data from php page using asp.net code.

can anybody please help me out.

Update :: Is the P3P policy will usefull in case of cross domain page calling.

like image 309
gofor.net Avatar asked Nov 30 '25 20:11

gofor.net


1 Answers

I got the solutions,thanks for your help.

create a new WebClient object

WebClient client = new WebClient();

string url = "http://testurl.com/test.php";

create a byte array for holding the returned data

byte[] html = client.DownloadData(url);

use the UTF8Encoding object to convert the byte array into a string

UTF8Encoding utf = new UTF8Encoding();

get the converted string

string mystring = utf.GetString(html);
like image 175
gofor.net Avatar answered Dec 02 '25 10:12

gofor.net



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!