We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hello,
I have run into this problem recently where I request a page from http://start.csail.mit.edu/ and it returns with
Your browser doesn't support iframes
before I could request start.csail.mit.edu/answer.php?query=what+are+apples and it would work fine.
The code is:
String lines[] = loadStrings("http://start.csail.mit.edu/answer.php?query=what+are+apples");
println("there are " + lines.length + " lines");
for (int i = 0 ; i < lines.length; i++) {
println(lines[i]);
}
any suggestions on how to resolve this? Thanks in advance.
Answers
You probably need to use the Network Client to send a User-Agent string in the request. Some bad sites try to guess the browser and to serve pages differently depending on the result.
I have tried it with what you have suggested and still not getting the right results.
Well, your code get the page I see when I visit the URL you gave, so I am not sure what is wrong for you...
I suppose the annoying part is there is a redirection, or an Ajax call (JavaScript) that fetches the real results and display them later.
Something much harder to automate in Processing... Unless you find out what is the Rest API on the server side.
I looked what are the requests made in the page after the loading, and found out that the URL of the real query is now:
http://start.csail.mit.edu/justanswer.php?query=what+are+apples
thank you