开发者

Facebook API events.invite method error 114?

开发者 https://www.devze.com 2023-01-23 19:04 出处:网络
I\'m getting this error when I try and invite people to my event: 114 must be a valid ID string (e.g., \"123\") method events.invite ...

I'm getting this error when I try and invite people to my event: 114 must be a valid ID string (e.g., "123") method events.invite ...

Here i开发者_JAVA百科s my php5 code:

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://www.facebook.com/home.php");
    curl_setopt($ch, CURLOPT_USERAGENT, "Firefox/3.5");
    curl_setopt($ch, CURLOPT_COOKIEJAR, __DIR__ . "/cookie-jar/cookie.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, __DIR__ . "/cookie-jar/cookie.txt");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

    curl_exec($ch);
    $info = curl_getinfo($ch);

    curl_setopt($ch, CURLOPT_URL, "https://login.facebook.com/login.php");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "email=".urlencode($this->USERNAME)."&pass=".urlencode($this->PASSWORD));
    curl_exec($ch);
    sleep(10);
    curl_setopt($ch, CURLOPT_POST, 1);
    $URL = "https://api.facebook.com/method/events.invite";
    curl_setopt($ch, CURLOPT_URL, $URL);

    $POST_FIELDS = "eid=$EID&uids=$UIDS&access_token={$this->TOKEN}";

    curl_setopt($ch, CURLOPT_POSTFIELDS, $POST_FIELDS);
    $events = curl_exec($ch);
    print_r($events);

Any ideas?


The code is hard to read but I think it is because you are trying to set CURLOPT_POSTFIELDS twice on the same curl handler. Try closing the curl handler after the first request.

0

精彩评论

暂无评论...
验证码 换一张
取 消