Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

  • LoadString

    Not clear how the connection is happening.

    Server ===> PC ===> Arduino ?

    Are you using javascript or java? Can you share your a minimum amount of code showing the essence of your program?

    I can only suggest httprequest: https://forum.processing.org/two/search?Search=httprequest however more details are needed before a final solution.

    Welcome to the forum btw!

    Kf

  • HTTP POST request problem

    I think I have the same problem sending POST and GET requests. I use latest version of HttpRequest (which is 0.1.4) and I use an Android device. After solving a lot of issues I ended with an error I cannot resolve. My code is

      PostRequest post = new PostRequest("http://gtricho.dideles.gr/index.php", "UTF-8");
       post.addData("Fall","Any");
       post.addHeader("Content-Type", "application/json");
       post.send();
       println("Reponse Content: " + post.getContent());
       println("Reponse Content-Length Header: " + post.getHeader("Content-Length"));
    

    and the error I get is:

    FATAL EXCEPTION: Thread-198
    java.lang.NoSuchMethodError: org.apache.http.util.EntityUtils.consume
        at http.requests.PostRequest.send(Unknown Source)
        at processing.test.sensors.sensors$1.run(sensors.java:80)
        at java.lang.Thread.run(Thread.java:856)
    

    Has anyone succeeded sending post requests to a web page?....

  • Instagram API with Processing

    Hello, I am working on a project using Instagram API and found the code below from http://forum.processing.org/two/discussion/9601/instagram-api-integration-with-http-library posted by jayjaylu. I have a problem getting response from responseReceived() function below. getGram() is working, but responseReceived() isn't.. Anyone knows why? Please let me know. Thank you in advance.

     
        import com.francisli.processing.http.*;
         
        PImage userphoto;
        PImage profilepicture;
         
        String username;
        String tag;
        String[] tagStrings;
         
        String comment;
         
        com.francisli.processing.http.HttpClient client;
         
        void setup() {
          size(900, 800);
          smooth();
         
          client = new com.francisli.processing.http.HttpClient(this, "api.instagram.com");
          client.useSSL = true;
        }
         
        void getGrams() {
            //// instantiate a new HashMap
          HashMap params = new HashMap();
          //// put key/value pairs that you want to send in the request
          params.put("access_token", "1722917717.cbb3637.c9d399ea75b24dad9afe5f8b52e186db");
          params.put("count", "1");
          client.GET("/v1/tags/cats/media/recent.json", params);
        }
         
        void responseReceived(com.francisli.processing.http.HttpRequest request, com.francisli.processing.http.HttpResponse response) {
          println(response.getContentAsString());
          println("RESPONSE RECEIVED");
         
          //// we get the server response as a JSON object
          com.francisli.processing.http.JSONObject content = response.getContentAsJSONObject();
         
          //// get the "data" value, which is an array
          com.francisli.processing.http.JSONObject data = content.get("data");
         
          //// get the first element in the array
          com.francisli.processing.http.JSONObject first = data.get(0);
         
          //// the "user" value is another dictionary, from which we can get the "full_name" string value
          println(first.get("user").get("full_name").stringValue());
         
          //// the "caption" value is another dictionary, from which we can get the "text" string value
          //println(first.get("caption").get("text").stringValue());
         
          //// get profile picture
          println(first.get("user").get("profile_picture").stringValue());
         
          //// the "images" value is another dictionary, from which we can get different image URL data
          println(first.get("images").get("standard_resolution").get("url").stringValue());
         
          com.francisli.processing.http.JSONObject tags = first.get("tags");
          tagStrings = new String[tags.size()];
          for (int i = 0; i < tags.size(); i++) {
            tagStrings[i] = tags.get(i).stringValue();
          }
         
          comment = first.get("caption").get("text").stringValue();
          username = first.get("user").get("full_name").stringValue();
         
          String profilepicture_url = first.get("user").get("profile_picture").stringValue();
          profilepicture = loadImage(profilepicture_url, "png");
         
          String userphoto_url = first.get("images").get("standard_resolution").get("url").stringValue();
          userphoto = loadImage(userphoto_url, "png");
         
        }
         
         
        void draw() {
          background(255);
          imageMode(CENTER);
         
         
          if(frameCount % 100 == 0){
            println(frameCount);
            getGrams();
          }
         
          if (profilepicture != null) {
            image(profilepicture, 60, 70, 90, 90);
          }
          imageMode(CENTER);
          if (userphoto != null) {
            image(userphoto, width/2, height/2.25, 550, 550);
          }
         
          textSize(20);
          if (username != null) {
            text(username, 110, 115);
            fill(0);
          } else if (username == null) {
            text("null username", 110, 115);
            fill(0);
          }
         
          textSize(20);
          if (comment != null) {
            text(comment, 15, 700, 550, 100);
            fill(0);
          }
         
         
        }
    
  • JavaScript mode and MySQL query

    Sorry just realised you said you could do the ajax... So the problem is presumably parsing the data. Seeing as I'm likely to need something along these lines using PJS I thought I'd throw together a proof of concept:

    Main sketch - mostly written in 'Java'

    // the type declaration in JS Mode is a bit of a sham:
    // declare this variable to whatever type you like.  From
    //  what I've seen when it's running, the JS will coerce it
    // to do it's bidding...
    Object data; 
    Boolean runSketch = false;
    
    void setup() {
    
      getJson.parseData("https://api.github.com/users/blindfish3/repos", dataIsReturned);
    
    }
    
    void draw() {
      // waiting for ajax request to complete
      if(runSketch) {
       // now ready to do stuff with the data!
      }
      noLoop();
    }
    
    void dataIsReturned(Object inputData) {
       data = inputData;
    
       // Look at what your data returns and access it just as it appears:
       // an array of objects
       console.info(data[1].name);
       // you may occasionally have to use this notation - e.g. in case 
       // of spaces and special characters...
       console.info(data[1]["html_url"]);
       // the full object for reference
       console.info(data); 
    
       runSketch = true;
    }
    

    On a separate tab: getjson.js

    // code modified from:
    // https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started
    
    var getJson = (function() {
    
      var httpRequest; 
    
      function makeRequest(url, callback) {
    
        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
          httpRequest = new XMLHttpRequest();
        } else if (window.ActiveXObject) { // IE
          try {
            httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
          } 
          catch (e) {
            try {
              httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) {}
          }
        }
    
        if (!httpRequest) {
          alert('Giving up: Cannot create an XMLHTTP instance');
          return false;
        }
        httpRequest.onreadystatechange = callback;
        httpRequest.open('GET', url);
        httpRequest.send();
      }
    
      function getData() {
    
        var data ="";
        if (httpRequest.readyState === 4) {
          if (httpRequest.status === 200) {
            data = httpRequest.responseText;
          } else {
            data = 'There was a problem with the request.';
          }
        }
        return data;
      }
    
      function parseData(url, callback) {
    
        makeRequest(url, function() {
    
            var data = getData();
            data = JSON.parse(data);
            callback(data);
        });
    
      }
    
      return {
        parseData : parseData
    
      }
    
    })();
    

    This code is not my proudest moment :\">

    In the past I spent far too much time playing with jQuery and not learning proper JavaScript; so Ajax requests still don't come entirely naturally to me. It can obviously be improved but it serves its purpose here. Hit F12 > console to see the output.

    The key point is that there's a method that returns the parsed JSON data back to the sketch code. You can then pull the data values out as if from an array of objects using array/dot notation. The Java mode doesn't have to know that none of that arduous Class declaration has taken place ;)

    Note that IIRC the .js extension on the tab is the prompt to the parser to treat the code as pure JS and not try and validate it as Java...

    Like I said: this can be improved and there are a couple of errors being thrown that I'm not entirely happy about; but it runs...

  • Speech To Text Help

    @Guard:: i just realize now that i am wrong with your request: you ask for stt and i answered stupidly for tts! So forget and excuse for the mistake. As for the stt lib from Shultz i am not sure that it works with p5 2X, though, having got a look to the source, it seems that it could work also; basically there is a minim audiorecorder, then connection and httprequest sending the recorded file to chrome and waiting the response like a string. Problem could be that the chrome url is hard encoded and perhaps it is not the same now, try to verify this point...

  • Instagram API integration with HTTP library

    So I'm working on a project that pulls from instagram but I'm having some problems getting the api working with processing. I found some source code to work with here so I tried it out (just testing the waters with basically the same code to see if I could get the API working), but it doesn't work for me and I can't figure out why.

    It's using an http library by francisli, which I have successfully downloaded and installed from here. When I run my code (see below), I can see that getGrams() is successfully being called, as every second I get this message in the console (with the proper access token, of course):

    HttpClient: Connecting to api.instagram.com on port 443
    HttpClient: GET https://api.instagram.com:443/v1/tags/cats/media/recent.json?count=1&access_token=ACCESS_TOKEN HTTP/1.1
    

    The framerate is also printed in the console, so I know the if statement is working properly and such. However, nothing is being printed from the void responseReceived() function. According to the http library documentation, the void responseReceived() function should be called whenever processing receives a response from my GET request, so I can only assume that processing isn't receiving any responses.

    I don't think this is because of any access problems, since when I follow the link from my GET request (https://api.instagram.com:443/v1/tags/cats/media/recent.json?count=1&access_token=ACCESS_TOKEN), it's showing the relevant JSON just fine. So either Instagram isn't sending it to Processing, or Processing isn't getting it from Instagram. Or, instagram's api has changed recently, or the http library is not compatible with my version of processing (which is 2.2.1), or somethings just wrong with my code.

    So my question is, how can I get the Instagram API to work? I honestly have no idea what I'm doing wrong and no idea where to even begin to try to figure this out, so some help would be much appreciated.

    Thank you in advance.

    import com.francisli.processing.http.*;
    
    PImage userphoto;
    PImage profilepicture;
    
    String username;
    String tag;
    String[] tagStrings;
    
    String comment;
    
    com.francisli.processing.http.HttpClient client;
    
    void setup() {
      size(900, 800);
      smooth();
    
      client = new com.francisli.processing.http.HttpClient(this, "api.instagram.com");
      client.useSSL = true;
    }
    
    void getGrams() {
        //// instantiate a new HashMap
      HashMap params = new HashMap();
      //// put key/value pairs that you want to send in the request
      params.put("access_token", "1722917717.cbb3637.c9d399ea75b24dad9afe5f8b52e186db");
      params.put("count", "1");
      client.GET("/v1/tags/cats/media/recent.json", params);
    }
    
    void responseReceived(com.francisli.processing.http.HttpRequest request, com.francisli.processing.http.HttpResponse response) {
      println(response.getContentAsString());
      println("RESPONSE RECEIVED");
    
      //// we get the server response as a JSON object
      com.francisli.processing.http.JSONObject content = response.getContentAsJSONObject();
    
      //// get the "data" value, which is an array
      com.francisli.processing.http.JSONObject data = content.get("data");
    
      //// get the first element in the array
      com.francisli.processing.http.JSONObject first = data.get(0);
    
      //// the "user" value is another dictionary, from which we can get the "full_name" string value
      println(first.get("user").get("full_name").stringValue());
    
      //// the "caption" value is another dictionary, from which we can get the "text" string value
      //println(first.get("caption").get("text").stringValue());
    
      //// get profile picture
      println(first.get("user").get("profile_picture").stringValue());
    
      //// the "images" value is another dictionary, from which we can get different image URL data
      println(first.get("images").get("standard_resolution").get("url").stringValue());
    
      com.francisli.processing.http.JSONObject tags = first.get("tags");
      tagStrings = new String[tags.size()];
      for (int i = 0; i < tags.size(); i++) {
        tagStrings[i] = tags.get(i).stringValue();
      }
    
      comment = first.get("caption").get("text").stringValue();
      username = first.get("user").get("full_name").stringValue();
    
      String profilepicture_url = first.get("user").get("profile_picture").stringValue();
      profilepicture = loadImage(profilepicture_url, "png");
    
      String userphoto_url = first.get("images").get("standard_resolution").get("url").stringValue();
      userphoto = loadImage(userphoto_url, "png");
    
    }
    
    
    void draw() {
      background(255);
      imageMode(CENTER);
    
    
      if(frameCount % 100 == 0){
        println(frameCount);
        getGrams();
      }
    
      if (profilepicture != null) {
        image(profilepicture, 60, 70, 90, 90);
      }
      imageMode(CENTER);
      if (userphoto != null) {
        image(userphoto, width/2, height/2.25, 550, 550);
      }
    
      textSize(20);
      if (username != null) {
        text(username, 110, 115);
        fill(0);
      } else if (username == null) {
        text("null username", 110, 115);
        fill(0);
      }
    
      textSize(20);
      if (comment != null) {
        text(comment, 15, 700, 550, 100);
        fill(0);
      }
    
    
    }
    
  • Instagram & Processing - Real time view

    Hello.

    I'm currently studying new medias & digital arts and I'm trying, for an assignment about the specificities of new medias archives, to build an app allowing a user to mix the twitter and instagram flows of information corresponding to the same hashtag. I managed the twitter part and I found the globalgram code but I can't seem to make it work (I'm kind of new to APIs and all that). The framecount is indeed displayed in the console which doesn't indicate any code error, but nothing seems to came out from the responseReceived() function. Any idea why ?

    The code I'm using, which is approximately the same than above

    import com.francisli.processing.http.*;
    
    PFont InstagramFont;
    PImage backgroundimg;
    PImage brand;
    PImage userphoto;
    PImage profilepicture;
    
    String username;
    String tag;
    String[] tagStrings;
    
    String comment;
    
    com.francisli.processing.http.HttpClient client;
    
    void setup() {
      size(580, 900);
      smooth();
      //backgroundimg = loadImage("iso_background.jpg");
      //brand = loadImage("iso.jpg");
    
      InstagramFont = loadFont("ACaslonPro-Bold-48.vlw");
    
      client = new com.francisli.processing.http.HttpClient(this, "api.instagram.com");
      client.useSSL = true;
    
    
    }
    
    void getGrams() {
        //// instantiate a new HashMap
      HashMap params = new HashMap();
      //// put key/value pairs that you want to send in the request
      params.put("access_token", "1575021377.etc");
      params.put("count", "0");
      client.GET("/v1/tags/newyork/media/recent.json", params);
    }
    
    void responseReceived(com.francisli.processing.http.HttpRequest request, com.francisli.processing.http.HttpResponse response) {
      println(response.getContentAsString());
    
      //// we get the server response as a JSON object
      com.francisli.processing.http.JSONObject content = response.getContentAsJSONObject();
    
      //// get the "data" value, which is an array
      com.francisli.processing.http.JSONObject data = content.get("data");
    
      //// get the first element in the array
      com.francisli.processing.http.JSONObject first = data.get(0);
    
      //// the "user" value is another dictionary, from which we can get the "full_name" string value
      println(first.get("user").get("full_name").stringValue());
      //// the "caption" value is another dictionary, from which we can get the "text" string value
      //println(first.get("caption").get("text").stringValue());
      //// get profile picture
      println(first.get("user").get("profile_picture").stringValue());
      //// the "images" value is another dictionary, from which we can get different image URL data
      println(first.get("images").get("standard_resolution").get("url").stringValue());
    
      com.francisli.processing.http.JSONObject tags = first.get("tags");
      tagStrings = new String[tags.size()];
      for (int i = 0; i < tags.size(); i++) {
        tagStrings[i] = tags.get(i).stringValue();
      } 
    
      comment = first.get("caption").get("text").stringValue();
      username = first.get("user").get("full_name").stringValue();
    
      String profilepicture_url = first.get("user").get("profile_picture").stringValue();
      profilepicture = loadImage(profilepicture_url, "png");
    
      String userphoto_url = first.get("images").get("standard_resolution").get("url").stringValue();
      userphoto = loadImage(userphoto_url, "png");
    
     //noLoop();
    }
    
    
    void draw() {
      background(255);
      imageMode(CENTER);
      //image(brand, 100, height/1.05);
    
      println(frameCount);
    
      if(frameCount % 1000 == 0){
        getGrams();
      }
    
      if (profilepicture != null) {
        image(profilepicture, 60, 70, 90, 90);
      }
      imageMode(CENTER);
      if (userphoto != null) {
        image(userphoto, width/2, height/2.25, 550, 550);
      }
    
      textFont(InstagramFont, 20);
      if (username != null) {
        text(username, 110, 115);
        fill(0);
      }
    
      textFont(InstagramFont, 15);
      if (comment != null) {
        text(comment, 15, 700, 550, 100);
        fill(0);
      }
    
    
    }
    
  • How to load Instagram photos?

    Hi everyone..

    I am trying to load Instagram photos using processing. This is school project and I am not good at programming.. Also I don't know about JSON or Jquery.. but I want to do this.. I need your help!

    I found proper library, so I imported it. And below is my code I followed other code. (ref: http://forum.processing.org/two/discussion/6011/instagram-processing-real-time-view#Item_3)

    1. I want to know how I can combine Instagram API and below code.
    -myClient.GET("/v1/media/popular.json", params);
    e.g. If Instagram provide below API,
    https://api.instagram.com/v1/media/3?access_token=ACCESS-TOKEN
    Can I use that like..
    -myClient.GET("/v1/media/3.json", params);

    2. I think the responseReceived() was not activated. I see some messages about requesting.. but I couldn't see any messages about responses..

    If you wanna try this, you can get user_token from below link. However, you need to get Client ID from Instagram and register Redirect URL to them.
    - https://instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token

    I really need your help! Please don't pass by me coding genius!!!

    import com.francisli.processing.http.*;
    
    HttpClient myClient;
    
    String username = USER_NAME;
    String usertoken = USER_TOKEN;
    PImage userphoto;
    
    void setup(){
      size(720,720);
      smooth();
    
      myClient = new HttpClient(this, "api.instagram.com");
      myClient.useSSL = true; 
    }
    
    void getGrams() {
        //// instantiate a new HashMap
      HashMap params = new HashMap();
      //// put key/value pairs that you want to send in the request
      params.put("access_token", usertoken);
      params.put("count", "0");
      myClient.GET("/v1/media/popular.json", params);
    }
    
    void responseReceived(HttpRequest request, HttpResponse response) {
    
      println(response.getContentAsString());
    
      //// we get the server response as a JSON object
      com.francisli.processing.http.JSONObject content = response.getContentAsJSONObject();
    
      //// get the "data" value, which is an array
      com.francisli.processing.http.JSONObject data = content.get("data");
    
      //// get the first element in the array
      com.francisli.processing.http.JSONObject first = data.get(0);
    
      //// the "user" value is another dictionary, from which we can get the "full_name" string value
      println(first.get("user").get("full_name").stringValue());
      //// the "caption" value is another dictionary, from which we can get the "text" string value
      //println(first.get("caption").get("text").stringValue());
      //// get profile picture
      println(first.get("user").get("profile_picture").stringValue());
      //// the "images" value is another dictionary, from which we can get different image URL data
      println(first.get("images").get("standard_resolution").get("url").stringValue());
    /*
      com.francisli.processing.http.JSONObject tags = first.get("tags");
      tagStrings = new String[tags.size()];
      for (int i = 0; i < tags.size(); i++) {
        tagStrings[i] = tags.get(i).stringValue();
      }
    */
    
      username = first.get("user").get("full_name").stringValue();
    
    /*
      String profilepicture_url = first.get("user").get("profile_picture").stringValue();
      profilepicture = loadImage(profilepicture_url, "png");
    */
      String userphoto_url = first.get("images").get("standard_resolution").get("url").stringValue();
      userphoto = loadImage(userphoto_url, "png");
    
     //noLoop();
    
     //Display Photo();
    
    }
    
    void draw() {
    
      background(255);
       display();
    
    }
    
    void mouseClicked() {
      //Call Instagram
      getGrams();
    }
    
    void display() {
    
        if (userphoto != null) {
        image(userphoto, width/2, height/2.25, 550, 550);
      } else {
        println("User photo is NULL");
      }
    
      if (username != null) {
        text(username, 110, 115);
        fill(0);
      }
    }
    

  • Instagram & Processing - Real time view

    Thanks to the help of jesses.co.tt over on stackoverflow this is now working - If anyone is interested here is the working code :

    import com.francisli.processing.http.*;
    
    PFont InstagramFont;
    PImage backgroundimg;
    PImage brand;
    PImage userphoto;
    PImage profilepicture;
    
    String username;
    String tag;
    String[] tagStrings;
    
    String comment;
    
    com.francisli.processing.http.HttpClient client;
    
    void setup() {
      size(580, 900);
      smooth();
      backgroundimg = loadImage("globalgram_background.jpg");
      brand = loadImage("iso.jpg");
    
      InstagramFont = loadFont("Helvetica-Bold-36.vlw");
    
      client = new com.francisli.processing.http.HttpClient(this, "api.instagram.com");
      client.useSSL = true;
    
    
    }
    
    void getGrams() {
        //// instantiate a new HashMap
      HashMap params = new HashMap();
      //// put key/value pairs that you want to send in the request
      params.put("access_token", "---Access Token---");
      params.put("count", "0");
      client.GET("/v1/tags/newyork/media/recent.json", params);
    }
    
    void responseReceived(com.francisli.processing.http.HttpRequest request, com.francisli.processing.http.HttpResponse response) {
      println(response.getContentAsString());
    
      //// we get the server response as a JSON object
      com.francisli.processing.http.JSONObject content = response.getContentAsJSONObject();
    
      //// get the "data" value, which is an array
      com.francisli.processing.http.JSONObject data = content.get("data");
    
      //// get the first element in the array
      com.francisli.processing.http.JSONObject first = data.get(0);
    
      //// the "user" value is another dictionary, from which we can get the "full_name" string value
      println(first.get("user").get("full_name").stringValue());
      //// the "caption" value is another dictionary, from which we can get the "text" string value
      //println(first.get("caption").get("text").stringValue());
      //// get profile picture
      println(first.get("user").get("profile_picture").stringValue());
      //// the "images" value is another dictionary, from which we can get different image URL data
      println(first.get("images").get("standard_resolution").get("url").stringValue());
    
      com.francisli.processing.http.JSONObject tags = first.get("tags");
      tagStrings = new String[tags.size()];
      for (int i = 0; i < tags.size(); i++) {
        tagStrings[i] = tags.get(i).stringValue();
      } 
    
      comment = first.get("caption").get("text").stringValue();
      username = first.get("user").get("full_name").stringValue();
    
      String profilepicture_url = first.get("user").get("profile_picture").stringValue();
      profilepicture = loadImage(profilepicture_url, "png");
    
      String userphoto_url = first.get("images").get("standard_resolution").get("url").stringValue();
      userphoto = loadImage(userphoto_url, "png");
    
     //noLoop();
    }
    
    
    void draw() {
      background(255);
      imageMode(CENTER);
      image(brand, 100, height/1.05);
    
      println(frameCount);
    
      if(frameCount % 1000 == 0){
        getGrams();
      }
    
      if (profilepicture != null) {
        image(profilepicture, 60, 70, 90, 90);
      }
      imageMode(CENTER);
      if (userphoto != null) {
        image(userphoto, width/2, height/2.25, 550, 550);
      }
    
      textFont(InstagramFont, 20);
      if (username != null) {
        text(username, 110, 115);
        fill(0);
      }
    
      textFont(InstagramFont, 15);
      if (comment != null) {
        text(comment, 15, 700, 550, 100);
        fill(0);
      }
    
    
    }
    
  • Instagram & Processing - Real time view

    I'm working on a small app similar to instaprint and need some help. I'm using the source code from Globalgram by Andrew Haskin, it searches instagram for a particular hashtag and displays the most recent image posted with that hashtag. The problem is it only does it once, I need it to continuously search for the hashtag and display an image when a new one is added, so a refresh, I've been tinkering with it but to no avail. Any help would be greatly appreciated

    Code Below :

    import com.francisli.processing.http.*;
    
    PFont InstagramFont;
    PImage backgroundimg;
    PImage brand;
    PImage userphoto;
    PImage profilepicture;
    
    String username;
    String tag;
    String[] tagStrings;
    
    
    com.francisli.processing.http.HttpClient client;
    
    void setup() {
      size(580, 900);
      smooth();
      backgroundimg = loadImage("iso_background.jpg");
      brand = loadImage("iso.jpg");
    
      InstagramFont = loadFont("Helvetica-Bold-36.vlw");
    
      client = new com.francisli.processing.http.HttpClient(this, "api.instagram.com");
      client.useSSL = true;
    
      //// instantiate a new HashMap
      HashMap params = new HashMap();
      //// put key/value pairs that you want to send in the request
      params.put("access_token", "------ACCESS TOKEN HERE------");
      params.put("count", "1");
      client.GET("/v1/tags/coffee/media/recent.json", params);
    }
    
    void responseReceived(com.francisli.processing.http.HttpRequest request, com.francisli.processing.http.HttpResponse response) {
      println(response.getContentAsString());
    
      //// we get the server response as a JSON object
      com.francisli.processing.http.JSONObject content = response.getContentAsJSONObject();
    
      //// get the "data" value, which is an array
      com.francisli.processing.http.JSONObject data = content.get("data");
    
      //// get the first element in the array
      com.francisli.processing.http.JSONObject first = data.get(0);
    
      //// the "user" value is another dictionary, from which we can get the "full_name" string value
      println(first.get("user").get("full_name").stringValue());
      //// the "caption" value is another dictionary, from which we can get the "text" string value
      //println(first.get("caption").get("text").stringValue());
      //// get profile picture
      println(first.get("user").get("profile_picture").stringValue());
      //// the "images" value is another dictionary, from which we can get different image URL data
      println(first.get("images").get("standard_resolution").get("url").stringValue());
    
      com.francisli.processing.http.JSONObject tags = first.get("tags");
      tagStrings = new String[tags.size()];
      for (int i = 0; i < tags.size(); i++) {
        tagStrings[i] = tags.get(i).stringValue();
      }
    
    
      username = first.get("user").get("full_name").stringValue();
    
    
      String profilepicture_url = first.get("user").get("profile_picture").stringValue();
      profilepicture = loadImage(profilepicture_url, "png");
    
      String userphoto_url = first.get("images").get("standard_resolution").get("url").stringValue();
      userphoto = loadImage(userphoto_url, "png");
    
     //noLoop();
    }
    
    
    void draw() {
      background(255);
      imageMode(CENTER);
      image(brand, 100, height/1.05);
    
    
      if (profilepicture != null) {
        image(profilepicture, 60, 70, 90, 90);
      }
      imageMode(CENTER);
      if (userphoto != null) {
        image(userphoto, width/2, height/2.25, 550, 550);
      }
    
      textFont(InstagramFont, 20);
      if (username != null) {
        text(username, 110, 115);
        fill(0);
      }
    
       textFont(InstagramFont, 15);
      if ((tagStrings != null) && (tagStrings.length > 0)) {
        String line = tagStrings[0];
        for (int i = 1; i < tagStrings.length; i++) {
          line += ", " + tagStrings[i];
        }
        text(line, 25, 720, 550, 50);
        fill(0);
      }
    
    }