@@ -150,6 +150,7 @@ abstract class BaseFacebook
150
150
'api_video ' => 'https://api-video.facebook.com/ ' ,
151
151
'api_read ' => 'https://api-read.facebook.com/ ' ,
152
152
'graph ' => 'https://graph.facebook.com/ ' ,
153
+ 'graph_video ' => 'https://graph-video.facebook.com/ ' ,
153
154
'www ' => 'https://www.facebook.com/ ' ,
154
155
);
155
156
@@ -750,6 +751,21 @@ protected function _restserver($params) {
750
751
return $ result ;
751
752
}
752
753
754
+ /**
755
+ * Return true if this is video post.
756
+ *
757
+ * @param string $path The path
758
+ * @param string $method The http method (default 'GET')
759
+ *
760
+ * @return boolean true if this is video post
761
+ */
762
+ protected function isVideoPost ($ path , $ method = 'GET ' ) {
763
+ if ($ method == 'POST ' && preg_match ("/^(\/)(.+)(\/)(videos)$/ " , $ path )) {
764
+ return true ;
765
+ }
766
+ return false ;
767
+ }
768
+
753
769
/**
754
770
* Invoke the Graph API.
755
771
*
@@ -767,8 +783,14 @@ protected function _graph($path, $method = 'GET', $params = array()) {
767
783
}
768
784
$ params ['method ' ] = $ method ; // method override as we always do a POST
769
785
786
+ if ($ this ->isVideoPost ($ path , $ method )) {
787
+ $ domainKey = 'graph_video ' ;
788
+ } else {
789
+ $ domainKey = 'graph ' ;
790
+ }
791
+
770
792
$ result = json_decode ($ this ->_oauthRequest (
771
- $ this ->getUrl (' graph ' , $ path ),
793
+ $ this ->getUrl ($ domainKey , $ path ),
772
794
$ params
773
795
), true );
774
796
0 commit comments