本文整理汇总了PHP中Facebook\Facebook::request方法的典型用法代码示例。如果您正苦于以下问题:PHP Facebook::request方法的具体用法?PHP Facebook::request怎么用?PHP Facebook::request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook\Facebook
的用法示例。
在下文中一共展示了Facebook::request方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPageDataFromFacebook
/**
* Call Facebook API and fetch page data
*
* @param Facebook ID of the page $page_id
* @param Database Access token $access_token
*
* @return GraphPage
*/
public function getPageDataFromFacebook($page_id, $access_token)
{
$params = array('fields' => 'access_token, picture.width(140).height(140){url}, hometown, about, bio, band_members, artists_we_like, booking_agent, website');
$request = $this->facebook->request('GET', '/' . $page_id, $params, $access_token);
try {
$response = $this->facebook->getClient()->sendRequest($request);
} catch (Exception $e) {
dd($e);
}
return $response->getGraphPage();
}
示例2: testCreatingANewRequestWillDefaultToTheProperConfig
public function testCreatingANewRequestWillDefaultToTheProperConfig()
{
$config = array_merge($this->config, ['default_access_token' => 'foo_token', 'enable_beta_mode' => true, 'default_graph_version' => 'v1337']);
$fb = new Facebook($config);
$request = $fb->request('FOO_VERB', '/foo');
$this->assertEquals('1337', $request->getApp()->getId());
$this->assertEquals('foo_secret', $request->getApp()->getSecret());
$this->assertEquals('foo_token', (string) $request->getAccessToken());
$this->assertEquals('v1337', $request->getGraphVersion());
$this->assertEquals(FacebookClient::BASE_GRAPH_URL_BETA, $fb->getClient()->getBaseGraphUrl());
}
示例3: testCreatingANewRequestWillDefaultToTheProperConfig
public function testCreatingANewRequestWillDefaultToTheProperConfig()
{
$config = array_merge($this->config, ['default_access_token' => 'foo_token', 'http_client_handler' => new FooClientInterface(), 'persistent_data_handler' => new FooPersistentDataInterface(), 'enable_beta_mode' => true, 'default_graph_version' => 'v1337']);
$fb = new Facebook($config);
$request = $fb->request('FOO_VERB', '/foo');
$this->assertInstanceOf('Facebook\\Tests\\FooClientInterface', $fb->getClient()->getHttpClientHandler());
$this->assertInstanceOf('Facebook\\Tests\\FooPersistentDataInterface', $fb->getRedirectLoginHelper()->getPersistentDataHandler());
$this->assertEquals(FacebookClient::BASE_GRAPH_URL_BETA, $fb->getClient()->getBaseGraphUrl());
$this->assertEquals('1337', $request->getApp()->getId());
$this->assertEquals('foo_secret', $request->getApp()->getSecret());
$this->assertEquals('foo_token', (string) $request->getAccessToken());
$this->assertEquals('v1337', $request->getGraphVersion());
}