How to get information from the web


Ive done a bit of searching and found that it is possible to use php with processing to get information from a web server that you have access to, but is it possible to get it from any web page? To be specific I am trying to get a piece of data displayed on survey monkey for a survey i made.




  • Using loadStrings() you're able to get the html-source of a given URL. You then just have to find a way to extract the information you need. Give it a try:

    void setup() {
      size(800, 480);
      String[] source = loadStrings(ANY_URL_STRING_HERE);
      int y = 0;
      textAlign(LEFT, TOP);
      for(int i = 0; i < source.length; i++) {
        text(source[i], 10, y);
  • edited March 2014

    isn't survey monkey supporting some kind of api, e. g. xml or json? if this is the case then you should go this way instead of parsing html-files.

  • mschi I had a quick look for survey monkeys api, but i couldn't find one, ill have another look.

    eldahar i tried load strings, but (I'm assuming) because the webpage I'm trying to access is account specific it gives me errors ( not processing, but the lines processing returns from the web page) is there a way around this, such as some sort of way to send my account info in first to validate my credentials?

  • Answer ✓

    there seems to be an api that is using http and json:

  • Answer ✓

    If authentication is needed I don't think it's that simple since you need a way to handle the session with survey monkey. When using the website that usually is handled by the web browser but when using other software you need to take care of it yourself. A good starting point would be to first get familiar with the options SuveyMonkey provides. After you learned what is needed for authentication I think you'll need additional Java libraries to get it working right from Processing. But when you have access to a PHP enabled webserver you may fare better using an API wrapper. A wrapper like this one would on the one hand control all communication with Survey Monkey and on the other hand provide you an easy access to authentication and api methods.

Sign In or Register to comment.