Hi there,

I am trying to create api using source 
https://github.com/googleads/google-ads-php/
with windows

 I am create  credentials & account Access  I followed the steps README.md


protobuf extension php is quite difficult to install on *windows*. 
the only source i could find :
https://www.php.net/manual/tr/install.windows.building.php
but it says i need to download ide for it.it's a really long process. İs 
there a shortcut?




// method   *$googleAdsServiceClient->search,**searchStream *below does not 
give any response

*$response = $googleAdsServiceClient->search($this->CUSTOMER_ID, $reportQuery, 
['pageSize' =>$this->PAGE_SIZE]);*





GoogleAdsClientBuilder func. it returns the following result ,i'm not sure 
i got the right result. What result does a successful client return?


Google\Auth\Credentials\UserRefreshCredentials::__set_state(array(
   'auth' => 
  Google\Auth\OAuth2::__set_state(array(
     'authorizationUri' => NULL,
     'tokenCredentialUri' => 
    GuzzleHttp\Psr7\Uri::__set_state(array(
       'scheme' => 'https',
       'userInfo' => '',
       'host' => 'oauth2.googleapis.com',
       'port' => NULL,
       'path' => '/token',
       'query' => '',
       'fragment' => '',
       'composedComponents' => NULL,
    )),
     'redirectUri' => NULL,
     'clientId' => 'xxxxxxxxxxxxxxxxxxx',
     'clientSecret' => 'xxxxxxxxxxxxxxxx',
     'username' => NULL,
     'password' => NULL,
     'scope' => NULL,
     'state' => NULL,
     'code' => NULL,
     'issuer' => NULL,
     'audience' => NULL,
     'sub' => NULL,
     'expiry' => 3600,
     'signingKey' => NULL,
     'signingKeyId' => NULL,
     'signingAlgorithm' => NULL,
     'refreshToken' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
     'accessToken' => NULL,
     'idToken' => NULL,
     'expiresIn' => NULL,
     'expiresAt' => NULL,
     'issuedAt' => NULL,
     'grantType' => NULL,
     'extensionParams' => 
    array (
    ),
     'additionalClaims' => 
    array (
    ),
  )),
   'quotaProject' => NULL,
))


Please can you help me with these issues?

Thank you.


require APPPATH .'third_party\GoogleAdsApi\vendor\autoload.php';


use GetOpt\GetOpt;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentNames;
use Google\Ads\GoogleAds\Examples\Utils\ArgumentParser;
use Google\Ads\GoogleAds\Lib\V10\GoogleAdsClient;
use Google\Ads\GoogleAds\Lib\V10\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\V10\GoogleAdsException;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;
use Google\Ads\GoogleAds\V10\Common\PolicyTopicEntry;
use Google\Ads\GoogleAds\V10\Common\PolicyTopicEvidence;
use Google\Ads\GoogleAds\V10\Enums\AdTypeEnum\AdType;
use 
Google\Ads\GoogleAds\V10\Enums\PolicyTopicEntryTypeEnum\PolicyTopicEntryType;
use Google\Ads\GoogleAds\V10\Errors\GoogleAdsError;
use Google\Ads\GoogleAds\V10\Services\GoogleAdsRow;
use Google\ApiCore\ApiException;



class Google_ads_lib {


private $CUSTOMER_ID = '309-611-5082';
private $CAMPAIGN_ID = '16585441336';
private $CLIENT_TIMEOUT_MILLIS = 5 * 60 * 1000;

private $PAGE_SIZE = 10;


public function GetCampaignsCost() {


$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile(APPPATH.
'third_party\GoogleAdsApi\google_ads_php.ini')->build();


$session = (new GoogleAdsClientBuilder())
->fromFile(APPPATH.'third_party\GoogleAdsApi\google_ads_php.ini')
->withOAuth2Credential($oAuth2Credential)
->build();

$googleAdsServiceClient = $session->getGoogleAdsServiceClient();

$reportQuery = 'SELECT ad_group_ad.ad.id, '
. 'ad_group_ad.ad.type, '
. 'ad_group_ad.policy_summary.approval_status, '
. 'ad_group_ad.policy_summary.policy_topic_entries '
. 'FROM ad_group_ad '
. 'WHERE campaign.id = ' . $this->CAMPAIGN_ID . ' '
. 'AND ad_group_ad.policy_summary.approval_status = DISAPPROVED';


try {

$response = $googleAdsServiceClient->searchStream($this->CUSTOMER_ID, 
$reportQuery, ['pageSize' => $this->PAGE_SIZE, 'returnTotalResultsCount' => 
true,'timeoutMillis' => $this->CLIENT_TIMEOUT_MILLIS]);

//$response = $googleAdsServiceClient->search($this->CUSTOMER_ID, 
$reportQuery, ['pageSize' =>$this->PAGE_SIZE]);

} catch (GoogleAdsException $googleAdsException) {

echo "Request with ID '%s' has failed.%sGoogle Ads failure details:%s". 
PHP_EOL;

foreach ($googleAdsException->getGoogleAdsFailure()->getErrors() as $error) 
{
echo $error->getErrorCode()->getErrorCode().
$error->getMessage().
PHP_EOL;
}
exit(1);
} catch (ApiException $apiException) {
echo
$apiException->getMessage().
PHP_EOL;;
exit(1);
}


//Download report as a string.
// $ss;

}
}








-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/a02582dc-1e8c-440d-b30b-d6e263fe35adn%40googlegroups.com.

Reply via email to