Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

Commit ba3c9e5

Browse files
committed
Merge pull request #358 from zoharbabin/patch-1
added support for graph-video url
2 parents a7ec692 + a228d55 commit ba3c9e5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Facebook/FacebookRequest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ class FacebookRequest
5151
*/
5252
const BASE_GRAPH_URL = 'https://graph.facebook.com';
5353

54+
/**
55+
* @const string Graph API URL
56+
*/
57+
const BASE_VIDEO_GRAPH_URL = 'https://graph-video.facebook.com';
58+
5459
/**
5560
* @var FacebookSession The session used for this request
5661
*/
@@ -213,7 +218,13 @@ public function __construct(
213218
*/
214219
protected function getRequestURL()
215220
{
216-
return static::BASE_GRAPH_URL . '/' . $this->version . $this->path;
221+
$lastInPath = end(explode('/', $this->path));
222+
if ($lastInPath == 'videos' && $this->method === 'POST') {
223+
$baseUrl = static::BASE_VIDEO_GRAPH_URL;
224+
} else {
225+
$baseUrl = static::BASE_GRAPH_URL;
226+
}
227+
return $baseUrl . '/' . $this->version . $this->path;
217228
}
218229

219230
/**

0 commit comments

Comments
 (0)