Send request get and receive data

5

According to PagSeguro, I need to make a GET and then receive the data that comes in XML format Documentation .

I'm screwed in this part:

  

To consult a transaction notification, you must make a   the Notification Query API, informing the   notification. The figure below illustrates a call to this API, which   uses the HTTP protocol and the GET method (the lines were broken   for easy reading).

Then I did the following:

string pagina = string.Format("https://ws.pagseguro.uol.com.br/v3/transactions/notifications/{0}?email={1}&token={2}",notificationCode, email, token);

Searching I came to this code to be doing a GET on the page:

System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(pagina);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";

But I do not know how to proceed.

What I did, right? And now how can I be receiving the Pagseguro data?

    
asked by anonymous 13.10.2014 / 14:07

2 answers

1

What I did, right?

Apparently, yes. Just trying to really know.

And how now can I be receiving the data from the Pagseguro?

Sending the request:

WebResponse response = request.GetResponse();

Here's how to use the WebRequest class here .

    
13.10.2014 / 22:58
0

In addition to @Gigano's response, you should change the Method to "GET."

req.Method = "GET";

WebResponse response = req.GetResponse();
    
11.05.2015 / 13:52