Coder Social home page Coder Social logo

Comments (6)

la-bas avatar la-bas commented on April 20, 2024

Sorry, now I've got it.
If anyone else ever gets as confused as I was, this is the solution:

    $account = new AdAccount('act_' . $accountID);
    $reports = $account->getReportsStats($fields, $params);
    $response = array();
    foreach($reports as $report) {
        $response[] = $report->getData();
    }

    return json_encode($response);  

from facebook-php-business-sdk.

paulbain avatar paulbain commented on April 20, 2024

it looks like you're doing a lot of work to just get the json again, you may want to think about something like:

$json = $reports->getResponse()->getRawResponse(); 

from facebook-php-business-sdk.

la-bas avatar la-bas commented on April 20, 2024

Thanks, much better!

from facebook-php-business-sdk.

siegerhansma avatar siegerhansma commented on April 20, 2024

I am using the same code as la-bas but I'm greeted with a permission error. It seems I can't reach reports as an Analyst account while I can reach the reports via the Ads Manager. What's the difference between calling them in the browser and calling them in code?

Error:
This Ads API call requires the user to be admin of the ad account. User xxxxxxxxxxxx not admin on ad account xxxxxxxxxxxxxxxxxxxxx.

from facebook-php-business-sdk.

paulbain avatar paulbain commented on April 20, 2024

@siegerhansma, please create a new issue with the exact series of requests your using and we can look into it

from facebook-php-business-sdk.

paulbain avatar paulbain commented on April 20, 2024

The SDK requires PHP 5.4 and above so this is why you see these errors.

Sent from my iPhone

On Dec 5, 2014, at 7:55 PM, sandy69 [email protected] wrote:

I am getting PHP Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION in /FacebookAds/Object/AdAccount.php on line 34

Below is the PHP Code, where I am accessing the class. Please let me know, if you see any issues with the code. I am not a PHP Expert. Thanks.

array ( 'account_id', 'total_actions', 'spend' ), 'date_preset' => 'last_7_days', ); $account = new AdAccount('act_' . $accountID); $account->getReportsStats($fields, $params); return json_encode($account->getData()); ?>


Reply to this email directly or view it on GitHub.

from facebook-php-business-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.