-->
Page 1 of 1

Facebook graph api HTTPS

PostPosted: Mon Apr 25, 2016 4:41 pm
by eduardogi
Hello everyone :)
I'm trying to make a likes counter to facebook page. I've tried to make a GET request, but I need use HTTPS,
I've tried modify the example, but i don't recieve anything. I also need help to find the fingerprint. Can someone help me please?
That's my code:
Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>

const char* ssid     = "Casa";
const char* password = "micasa";

const char* host = "graph.facebook.com";
const char* url   = "/v2.6/200630963285751?fields=fan_count&access_token=";
const char* token = "xxxxxxxxxxxxxxx";
const char* fingerprint = "CF 05 98 89 CA FF 8E D8 5E 5C E0 C2 E4 F7 E6 C3 C7 50 DD 5C";
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.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

int value = 0;

void loop() {
  delay(1000);
  ++value;
  // Use WiFiClient class to create https connections
  WiFiClientSecure client;
  Serial.print("connecting to ");
  Serial.println(host);
  const int httpPort = 443;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
  }

  // We now create a URI for the request
  // This will send the request to the server
  String paquete = String("GET ") + url + token + " HTTP/1.1\r\n" + "Host:" + host + "\r\n\r\n";
  Serial.println(paquete);
  client.print(paquete);

  delay(1000);

  // 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");
}

Regards :)

Re: Facebook graph api HTTPS

PostPosted: Tue Jul 12, 2016 11:09 pm
by iamtomriddle
I have same problem. So do you have soluction? :cry: :cry: :cry:

Re: Facebook graph api HTTPS

PostPosted: Wed Jul 13, 2016 10:22 am
by iamtomriddle
I have same problem, do you have solution?