I am using jonasva's laravel facebook insights package ( https://github.com/jonasva/laravel-facebook-insights).
And stuck at the very beginning. So if someone is familiar and can help me out.
I have setup the facebook-insights.php with all the information that is needed. (AppID, Secret, ermanent access token ...)
However, when I try to get the PageTotalImpressions I receive the number 0
FacebookInsightsController:
//Get Facebook PageImpressions
public function getPageImpressions() {
$startDate = new \DateTime('2017-01-01');
$endDate = new \DateTime('2017-03-26');
// fetch your page's total impressions for a given period
$totalImpressions = FacebookInsights::getPageTotalImpressions($startDate, $endDate);
return $totalImpressions;
}
I know that there are Impressions, as Facebook Insights shows different numbers.
Any idea what's wrong here ?
thanks
I just tried using this package myself, I stopped and removed it before even delving in.
On the composer install it states that it loaded php-sdk-v4 which has been abandoned jonasva's laravel facebook insights package has not been updated for over 2 years.
I recommend you do the same as me and begin searching for a new package.
Related
I'm looking to get the user_location on login but it doesn't seem to work. I presumed the parameter in the graph was "locations" but it claims it's been deprecated as of 2.2. Are you not able to get user location anymore or is it because it's an array I need to do something extra? I can't seem to find the answer in the documentation. Thanks in advance.
My code:
$profile_request = $fb->get('/me?fields=first_name,last_name,email,gender');
$requestLikes = $fb->get('/me/likes?limit=20');
$requestlocation = $fb->get('/me/locations');
$profile = $profile_request->getGraphNode()->asArray();
$likes = $requestLikes->getGraphEdge();
$location = $requestlocation->getGraphNode()->asArray();
My error:
Graph returned an error: (#12) locations API is deprecated for versions v2.0 and higher
OK so I solved it. I don't know why but when I took "location" in with the array profile[] I was able to retrieve it. Not exactly sure why this works yet.
I would like to create a campaign using Facebook API. I tried to run all available example without success.
First of all I created an App in order to have a APP_ID and a APP_SECRET.
I did all the procedure to add my Ad_account following the tutorial.
I downloaded all the SDK to facilitate Facebook API use like:
facebook-php-ads-sdk and run adgroup_creation.php and curl_log.php with my data, without success.
facebook-php-sdk-v4 I suppose it is less specific than the previous one.
Multi-Product Ads with the Facebook Marketing POST -> developers.facebook.com/ads/blog/post/2015/03/26/creating-multi-product-ads/
the developers reference -> developers.facebook.com/docs/reference/php/4.0.0
I used "Composer" to get all dependency.
In all this case I had problem to create a campaign using more or less this code:
$campaign = new \FacebookAds\Object\AdCampaign(null,"act_$ACCOUNT_ID");
$campaign->setData(array(
AdCampaignFields::NAME => 'My First Campaign',
AdCampaignFields::OBJECTIVE => AdObjectives::WEBSITE_CLICKS,
AdCampaignFields::STATUS => AdCampaign::STATUS_PAUSED ));
// PROBLEM is Here
$campaign->create();
Any help? How can I get a more useful error?
It's difficult to help without knowing the exact error. However, you could try this: before creating your campaign, initialize the API using:
Api::init(<your_app_id>, <your_ap_secret>, <your_token>);
(You need to load FacebookAds\Api to use this function).
I am implementing adword api version 201306 in one of my project. I am able to fetch the details of a campaign but unable to retrieve the budget details.
My goal is to access the budget details and modify them. I am using PHP library and request to all of you a piece of code written in php.
Any help would be highly appreciated.
Thanks,
Pramod
I found the solution and here is the way you need to go out - -
First you need to pass out the field 'BudgetId' in Campaign Service selector for CampaignStats.
Now you can use following code - -
$budgetService = $user->GetService('BudgetService', ADWORDS_VERSION);
$bm = new Money('10000000');
$campaign->budget->amount = $bm;
$boperation = new BudgetOperation();
$boperation->operand = $campaign->budget;
$boperation->operator = 'SET';
$budgetService->mutate($boperation);
Yes, I agree that this help is very less. Do let me know if anyone face any issue OR need more help.
Regards,
Pramod
I can perfectly add an event with Google Calendar API V3 as described in https://developers.google.com/google-apps/calendar/recurringevents but I can't figure how to start on the update event process.
I guess I have to select the event (I do have the event ID stored on my DB) and then set the parameters and call an update event. But don't know where to start...
There seems to be very few tutorials around. Any ideas please?
Ok I finally got the answer my self. Struggled to read on those Google API Explorer and matching them against the google-api-php-client. Anyway, here it is a simple code to update the description, summary and event color.
$apiClient = new apiClient();
$apiClient->setUseObjects(true);
$service = new apiCalendarService($apiClient);
$events = $service->events;
$currEvent = $events->get("primary", $event_id);
$currEvent->setDescription("YOUR FULL DESCRIPTION");
$currEvent->setSummary("YOUR DESIRED SUMMARY - Kind of title");
$currEvent->setColorId(2); // One of the available colors ID
$recurringEvent = $events->update('primary', $event_id, $currEvent);
Remember that this code needs to be ran only after authentication.
Hope it helps someone. It did me ;)
I been Googling reading trying week ago to do the following. I want to use Bugzilla API to create a new bug using PHP. There is an API so I don't want to work around but the problem is I can't login using the API.
I am using CodeIgniter FW and I found this after a long days of searching and reading:
public function tryBugZilla()
{
$this->load->library('xmlrpc');
$this->xmlrpc->server('http://link/xmlrpc.cgi', 80);
$this->xmlrpc->method('User.login');
$request = array('Bugzilla_login'=>'login', 'Bugzilla_password'=>'pass', 'product'=>'Your Product Name', 'component'=>'User Submitted', 'summary'=>'Test', 'version'=>'x.x', 'description'=>'asdas');
$this->xmlrpc->method('Bug.create');
$this->xmlrpc->request(array(array($request, 'struct')),'struct');
if(!$this->xmlrpc->send_request()) {
echo $this->xmlrpc->display_error();
}
// this returns ticket ID
print_r($this->xmlrpc->display_response());
//i get this:
// No data received from server
}
This is the source of the code
My Bugzilla version is 4.0.2
Also how can I use the Bugzilla REST API with PHP if its possible a sample code just for login I will continue
If you have the ability to use Zend libraries, then this might work for you:
http://petehowe.co.uk/2010/example-of-calling-the-bugzilla-api-using-php-zend-framework/
Also, here's a tutorial on using Zend with CI:
http://www.gotphp.com/codeigniter-with-zend-framework-libraries/54312/