Facebook API events.invite方法错误114?

时间:2010-11-08 07:15:08

标签: php curl facebook

当我尝试邀请别人参与我的活动时,我收到此错误:114必须是有效的ID字符串(例如“123”)方法events.invite ...

这是我的php5代码:

    $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);

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

代码很难阅读,但我认为这是因为您试图在同一个CURLOPT_POSTFIELDS处理程序上设置curl两次。尝试在第一次请求后关闭curl处理程序。