Closed cornernote closed 9 years ago
did you update to the latest version of the repo? this was fixed in 2.2: https://github.com/facebook/facebook-php-ads-sdk/commit/329dcc0eb7962a20586be19bb168b671700d7b0e
also it's probably better to import the files you want from the namespaces rather than fully qualifying every class:
use FacebookAds\Api;
use \FacebookAds\Object\TargetingSearch;
use \FacebookAds\Object\Search\TargetingSearchTypes;
Api::init($app_id, $app_secret, $access_token);
$results = TargetingSearch::search(
TargetingSearchTypes::INTEREST,
null,
'facebook'
);
print_r($results);
Updated to latest, works now.
I hate that I can't use namespace imports inside a class/method, so I do them inline. It's probably more readable to put them at the top of the class file so I might start doing that.
Thanks.
Here is my code:
The error is: Argument 1 passed to FacebookAds\Cursor::__construct() must implement interface FacebookAds\Http\ResponseInterface, array given, called in /vagrant/app/vendor/facebook/php-ads-sdk/src/FacebookAds/Object/TargetingSearch.php on line 74 and defined in file /vagrant/app/vendor/facebook/php-ads-sdk/src/FacebookAds/Cursor.php at line 84