我在迁移此特定代码段时遇到问题
// previously
$facebook = new Facebook(array(
'appId' => 'xxx',
'secret' => 'xxx',
));
$accessToken = $facebook->getApplicationAccessToken();
$facebook->setAccessToken($accessToken);
$facebook->api($url, 'POST');
// v4.0
$session = Facebook\FacebookSession::newAppSession('xxx','xxx');
$response = (new Facebook\FacebookRequest(
$session, 'POST', $url
))->execute();
这就是:
未捕获的异常' Facebook \ FacebookAuthorizationException' with message'(#803)您请求的某些别名不存在:v2.0557210865'
答案 0 :(得分:4)
$ url应该是/557210865
而不是557210865
。
答案 1 :(得分:-1)
facebook的Open Graph API不好用,甚至有些人不喜欢直接访问。
为此使用python
从硒导入网络驱动程序
#----
用户名=“ my_email@email.com” 密码=“ 123456”
driver = webdriver.Chrome(“ C:\ python \ chromedriver.exe”) driver.get(“ https://m.facebook.com/”)
username_textbox = driver.find_element_by_id(“ m_login_email”) username_textbox.send_keys(用户名)
password_textbox = driver.find_element_by_id(“ m_login_password”) password_textbox.send_keys(密码)
登录按钮= driver.find_element_by_id(“ u_0_4”) #login_button.submit()
#----