내 웹 사이트를 연결하여 Google 애드워즈에 연결하여 내 사이트의 제품에 따라 광고 및 캠프를 만들려고합니다. 직접 컬 요청을 보내서 연결을 시도하고 수신 된 SOAP 응답을 구문 분석했습니다. 그러나 각 요청에 대해 너무 복잡해지고 있습니다. 그래서 나는 Google Code에서 제공되는 PHP 클라이언트 라이브러리를 사용해 보았습니다. 그러나 예제 중 어느 것도 올바르게 작동하지 않습니다. 나는 auth.ini 파일에 사용자 계정 정보를 변경 여전히 예를 excecuting에이 Google Adword PHP 클라이언트 라이브러리가 호스트에 연결할 수 없습니다.
이 authToken에 가져 오지 못했습니다 말한다 파일. 이유 : 호스트 '에 연결할 수 없습니다.
다른 서버에서 스크립트를 실행했지만 여전히 동일한 오류가 발생했습니다. 다음
는Google 애드워즈의 모든 광고를 가져올 코드이며,이
DEFAULT_SERVER = "HTTPS 클라이언트 라이브러리
$path = dirname(__FILE__) . '/../../src'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); require_once 'Google/Api/Ads/AdWords/Lib/AdWordsUser.php'; try { // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $user = new AdWordsUser(); // Log SOAP XML request and response. $user->LogDefaults(); // Get the AdGroupAdService. $adGroupAdService = $user->GetAdGroupAdService(); $adGroupId = (float) '01'; // Create selector. $selector = new Selector(); $selector->fields = array('Id', 'AdGroupId', 'Status'); $selector->ordering = array(new OrderBy('Id', 'ASCENDING')); // Create predicates. $adGroupIdPredicate = new Predicate('AdGroupId', 'IN', array($adGroupId)); // By default disabled ads aren't returned by the selector. To return them // include the DISABLED status in a predicate. $statusPredicate = new Predicate('Status', 'IN', array('ENABLED', 'PAUSED', 'DISABLED')); $selector->predicates = array($adGroupIdPredicate, $statusPredicate); // Get all ads. $page = $adGroupAdService->get($selector); // Display ads. if (isset($page->entries)) { foreach ($page->entries as $adGroupAd) { printf("Ad with id '%s', type '%s', and status '%s' was found.\n", $adGroupAd->ad->id, $adGroupAd->ad->AdType, $adGroupAd->status); } } else { print "No ads were found.\n"; } } catch (Exception $e) { echo 'Inside catch exception'; print $e->getMessage(); }
에서와 settings.ini 파일의 예제 파일입니다 : //adwords-sandbox.google.com "
; AUTH_SERVER = "<SERVER>"
auth.ini 파일에서 Google 계정의 사용자 이름과 비밀번호가 올바르게 설정되었습니다.
이 문제가 해결 될 수 있도록 도와 줄 사람이 있습니까?
감사
사용중인 코드 중 일부를 표시하십시오. 어떤 호스트에 연결하려고합니까? 도달 할 수 있습니까? –