Facebook Monitoring

Everything else that doesn't fall into one of the other PB categories.
dige
Addict
Addict
Posts: 1432
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Facebook Monitoring

Post by dige »

hi folks, I'd like to download the following web page and automatically evaluate

https://graph.facebook.com/cocacola

The result is something like this:

Code: Select all

{
   ..
   "talking_about_count": 938145,
   "username": "coca-cola",
   "website": "http://www.coca-cola.com",
   "likes": 60926774,
   ..
}
There some difficulties: https and proxy-support.
Has anyone ever experience with the Facebook API?
"Daddy, I'll run faster, then it is not so far..."
dige
Addict
Addict
Posts: 1432
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: Facebook Monitoring

Post by dige »

As a first shot, I did it with libcurl:

Code: Select all

;================================================================
; Project   LibCurl
; Title     Sample_1
; Author    Progi1984
; Date      19/01/2008
; Notes     Sends a request to a HTTPS server
;================================================================

XIncludeFile "LibCurl_Res.pb"
XIncludeFile "LibCurl_Inc.pb"

  curl  = curl_easy_init()
fp  = CreateFile(#PB_Any, "Samples\Sample_1_SourceForge.htm")
If curl
  Debug curl_easy_setopt(curl, #CURLOPT_PROXY, @"192.168.1.1")
  Debug curl_easy_setopt(curl, #CURLPROXY_HTTP, 0)
  Debug curl_easy_setopt(curl, #CURLOPT_PROXYPORT, 8080)
  
  Debug curl_easy_setopt(curl, #CURLOPT_URL, @"https://graph.facebook.com/cocacola")
  Debug curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYPEER, 0)
  Debug curl_easy_setopt(curl, #CURLOPT_SSL_VERIFYHOST, 0)
  Debug curl_easy_setopt(curl, #CURLOPT_HEADER, 0) 
  Debug curl_easy_setopt(curl, #CURLOPT_WRITEFUNCTION, @RW_LibCurl_WriteFunction())
  res = curl_easy_perform(curl)
  Debug res
  
  WriteString(fp, RW_LibCurl_GetData(), 0)
  CloseFile(fp)
  
  ;always cleanup 
  Debug curl_easy_cleanup(curl)
EndIf

"Daddy, I'll run faster, then it is not so far..."
Post Reply