Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : xml retrieval

$
0
0
At http://bazaar.launchpad.net/~philho/+junk/Processing/view/head:/_QuickExperiments/_Net/HTTP_GET/HTTP_GET.pde I give an example to get data from an URL needing a user agent: some servers prefer to avoid automated connections, or rely on user agent to personalize answers or something.

Notice how the Client constructor takes only the top-level URL, the parameters must be given in the GET request.
Showing the lines I changed for testing your URL:
  1. void draw()
  2. {
  3.   if (step > 0)
  4.   {
  5.     println("------ " + step);
  6.     client = new Client(this, "www.teamliquid.net", 80);
  7.   }
  8.   switch (step)
  9.   {
  10.   case 1:
  11.     client.write("GET /video/streams/?xml=1&filter=live HTTP/1.1\r\n");
  12.     client.write("Host: www.teamliquid.net\r\n");
The fetched data is gzipped, so it shows binary data.

Viewing all articles
Browse latest Browse all 1768

Trending Articles