# I don't know how to communicate with internet

**URL:** <https://discourse.processing.org/t/i-dont-know-how-to-communicate-with-internet/8381>\
**Category:** Coding Questions\
**Created:** [February 13, 2019, 9:49pm UTC](https://discourse.processing.org/t/i-dont-know-how-to-communicate-with-internet/8381 "2019-02-13T21:49:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AngelsApple](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@AngelsApple](https://discourse.processing.org/u/AngelsApple)\
**Post date:** [February 13, 2019, 9:49pm UTC](https://discourse.processing.org/t/i-dont-know-how-to-communicate-with-internet/8381/1 "2019-02-13T21:49:23Z")

</div>

I’d like to write a code about data scrapping from internet

I set the target as downloading my facebook images and friends list, but It seems too hard for me

So now I’m trying to make easy sample that download google Log image from interet(like [google.com](http://google.com)), and search some words at google

I thought I could communicate with google’s IP with port number, but I don’t know what kind of libraries and functions are needed.

Any little tips will be very helpful to me. Please note me any tip please!

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [February 13, 2019, 10:09pm UTC](https://discourse.processing.org/t/i-dont-know-how-to-communicate-with-internet/8381/2 "2019-02-13T22:09:51Z")

</div>

You’re looking for something called an **API**.

For example Facebook has a bunch of APIs that give you programmatic access to Facebook data:

[https://developers.facebook.com/docs/apis-and-sdks/](https://developers.facebook.com/docs/apis-and-sdks/)

---

<div class="post-metadata">

**Author:** ![AngelsApple](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@AngelsApple](https://discourse.processing.org/u/AngelsApple)\
**Post date:** [February 13, 2019, 10:14pm UTC](https://discourse.processing.org/t/i-dont-know-how-to-communicate-with-internet/8381/3 "2019-02-13T22:14:23Z")

</div>

Thank you for tip!  
I think I should learn about standard comunication rules.  
Thankyou again!

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [February 14, 2019, 6:39am UTC](https://discourse.processing.org/t/i-dont-know-how-to-communicate-with-internet/8381/4 "2019-02-14T06:39:13Z")

</div>

following example is actually not too useful,  
unless it shows the use of

- loadStrings
- loadImage

with internet urls.

```auto
String[] incoming;
int srcindex, srcend;
String line,picsrc;
PImage found;
boolean foundone = false;

void setup() {
  size(400,400);
  incoming = loadStrings("https://google.com");
  //printArray(incoming);

  for (int i=0; i<incoming.length; i++) {
    srcindex=0;
    srcend=0;
    line = incoming[i];
    srcindex = line.indexOf("src=");
    srcend = line.indexOf(".png"); // search png files only
    if ( srcindex > 0 && srcend > 0 && srcend > srcindex) {
      println("i "+i+" srcindex "+srcindex+" srcend "+srcend);
      picsrc = "https://www.google.com"+line.substring(srcindex+5, srcend)+".png"; // not use src="
      println(picsrc);
      found = loadImage(picsrc);
      foundone = true;
    }
  }
}

void draw() {
  if ( foundone ) image(found,0,0);
}

```

 ![2019-02-14_13-42-55_snap](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/3d518435114fe482b059f08a0a6ac7174173b5bd.png)

---

<div class="post-metadata">

**Author:** ![AngelsApple](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@AngelsApple](https://discourse.processing.org/u/AngelsApple)\
**Post date:** [February 14, 2019, 8:14am UTC](https://discourse.processing.org/t/i-dont-know-how-to-communicate-with-internet/8381/5 "2019-02-14T08:14:56Z")

</div>

Thank you very much!  
Code is so good and clean so I could understand various knowledges  
I Think I should study more about HTML,XML,JSON structure, so then I’ll get informations of target page & ask to server to give me the needed data.
