I am using this library to make requests to various parts of different libraries, so far i am using the Google Plus and the Youtube Data API.
Running each example by itself works great, but when i want to execute both function in a batch i get
Fatal error: Cannot redeclare class Google_ActivitiesServiceResource in C:\XAMPP\htdocs\blog\wp-content\themes\blog\includes\google\contrib\Google_PlusService.php on line 88
class socialSearch {
private $google_key;
private $client;
public function __construct()
{
$this->result = array();
$this->google_key = "******";
$this->client = new Google_Client();
$this->client->setDeveloperKey($this->google_key);
}
function youtube_semantic_search($keyword) {
require_once ('google/contrib/Google_YoutubeService.php');
$youtube = new Google_YoutubeService($this->client);
$searchResponse_semantic = $youtube->search->listSearch('id,snippet', array(
'topicId' => $this->getFreebaseConcept($keyword),
'order' => 'viewCount',
'maxResults' => 5
));
if (isset($searchResponse_semantic)) {
foreach ($searchResponse_semantic["items"] as $video) {
$this->result["youtube"][] = $video;
}
}
}
function google_plus($keyword) {
require_once ('google/contrib/Google_PlusService.php');
$plus = new Google_PlusService($this->client);
$searchResponse = $plus->activities->search($keyword);
$this->result["google_plus"][] = $searchResponse;
}
so each function by itself works fine, but apparently when chained something happened .. i have even tried to pass a new client for each function but i got the same error as well ..