simple FACEBOOK LIKE COUNTER

Hello everyone!

First things first I’m a newby with arduino so please dont be uppset if I ask trivial questions.
As my first project I decided to make a really simple fb like counter, but it seems I stucked on the verry beginning.

The thing that I would like to read the answer of the following get request:

https://graph.facebook.com/shapenbake2018?access_token=EAAFBCZCd1lKoBABihTZCsWOvWHgX8qIWbO0TSxrwJAriYFgdZA0NKOtrcecQcMH0grb5UF9RKVsHKVbC4IeoR25ZBCEZCN8Qckn8VkbvKNr5HwqhqTzkOBHCBXe3YydUWOrVf9XbIuOjUYCTv87w2IVxwHeDLPZBP3bjovwvcL64OGy59JwQ7NSAiXpnSTk8ZCaSIW5XSEJDgZDZD&fields=fan_count

But the terminal answer seems to shows nothing or only a single carachter from the results.

Can somebody give me any advice where my code wrong and what should i do to be able to write fan_caunt value on terminal?

Thank you for your prompt answer and help! Happy New Year!!

Below I leave here the terminal result and my source

—TERMINAL—

17:07:05.628 → Connecting to UPC4191181
17:07:06.248 → …
17:07:10.037 → WiFi connected
17:07:10.037 → IP address:
17:07:15.055 → connecting to graph.facebook.com
17:07:20.127 → 2

— SOURCE —

#include <ESP8266WiFi.h>

const char* ssid     = "UPC4191181"; //Wi-Fi SSID
const char* password = "UYGRXZZG"; //Wi-Fi Password

//Only used if using Static IP
IPAddress ip(192, 168, 0, 6); //IP
IPAddress gatewayDNS(192, 168, 0, 1);//DNS and Gewateway
IPAddress netmask(255, 255, 255,0); //Netmask

//Server IP or domain name
const char* host = "graph.facebook.com";

void setup() {
  Serial.begin(115200);
  delay(10);

  // We start by connecting to a WiFi network

  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.config(ip,gatewayDNS,netmask,gatewayDNS); //Only used if using Static IP 
  WiFi.begin(ssid, password); //Connecting to the network
  
  while (WiFi.status() != WL_CONNECTED) { //Wait till connects
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  //Serial.println(WiFi.localIP()); //Use if using DHCP to know the IP
}

void loop() {
  delay(5000);

  Serial.print("connecting to ");
  Serial.println(host);
  
  WiFiClient client; //Client to handle TCP Connection
  const int httpPort = 443;
  if (!client.connect(host, httpPort)) { //Connect to server using port httpPort
    Serial.println("connection failed");
    return;
  }
  
  // We now create a URI for the request
  String url = "/shapenbake2018?access_token=EAAFBCZCd1lKoBABihTZCsWOvWHgX8qIWbO0TSxrwJAriYFgdZA0NKOtrcecQcMH0grb5UF9RKVsHKVbC4IeoR25ZBCEZCN8Qckn8VkbvKNr5HwqhqTzkOBHCBXe3YydUWOrVf9XbIuOjUYCTv87w2IVxwHeDLPZBP3bjovwvcL64OGy59JwQ7NSAiXpnSTk8ZCaSIW5XSEJDgZDZD&fields=fan_count"; //File or Server page you want to communicate with. along with data
  
  // This will send the request to the server 
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" + 
               "Connection: close\r\n\r\n");
  unsigned long timeout = millis();
  while (client.available() == 0) {
    if (millis() - timeout > 25000) { //Try to fetch response for 25 seconds
      Serial.println(">>> Client Timeout !");
      client.stop();
      return;
    }
  }
  
  // Read all the lines of the reply from server and print them to Serial
  while(client.available()){
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }
  Serial.println();
  Serial.println("closing connection");
  client.stop(); //Close Connection
}

You should try the HTTPClient library. It will make it easier. It looks like the response is JSON so you could either parse it directly (it's pretty trivial) or use a JSON library.

Hi,

Thank you so much!
It was a great idea, I allready made it work.
Now im trying to make the url by combining variables.

    fb_url = "https://graph.facebook.com/" + fb_pagename + "?access_token=" + fb_accesstoken + "&fields=fan_count";

all of my variables are const char* type and I’m getting the following error.

Could you help with it too?

invalid operands of types ‘const char [28]’ and ‘const char*’ to binary ‘operator+’

Answer already provided here. Please don't cross post, it's a waste of effort.