Seite 1 von 1

Adwords Api: Probleme mit dem PHP-Beispiel Code

Verfasst: 30.05.2005, 15:03
von canetti
Hallo alle zusammen,

kennt sich schon jemand mit der Adwords Api (PHP) aus?
Ich habe in die unterschiedlichen PHP-Samples meine Adwords-Zugangsdaten + Token eingegeben und immer folgenden Fehlercode erhalten:

-----------------
FAULT: 1

Code: soapenv:Server.generalException

String: An internal error has occurred. Please retry your request.

Detail:
-----------------

Selbstverständlich habe ich die entsprechende nusoap.php vorher in das Verzeichnis gelegt.

Es ist doch richtig, das mit Passwort und Benutzername die Adwords-Zugangsdaten gemeint sind und NICHT die google Developer-Zugangsdaten, oder?

Bin für jeden Tipp dankbar.
Gruß
canetti

Verfasst:
von

Adwords Api: Probleme mit dem PHP-Beispiel Code

Verfasst: 30.05.2005, 16:29
von sandoba
Wahrscheinlich hast du die neueste NuSOAP-Version genutzt. Diese liefert jedoch im Zusammenspiel mit der Adwords-API nur Fehlermeldungen zurück. Daher muss auf eine frühere Version zurückgegriffen werden. Die 1.82 von https://cvs.sourceforge.net/viewcvs.py/ ... nusoap.php funktioniert auf jedenfall. Mehr Informationen gibt es dazu übrigens auch in den Adwords-API Developer-Foren direkt bei Google.

Adwords Api: Probleme mit dem PHP-Beispiel Code

Verfasst: 30.05.2005, 18:56
von Southmedia
Robert hat absolut Recht, besorg dir die 1.82 dann sollte das laufen.

Verfasst: 31.05.2005, 09:18
von canetti
Hallo,

vielen Dank für Eure Tipps, nur leider liegt es nicht an der nusoap-Version! Ich habe es mit der 1.82er Version versucht - die gleiche Fehlermeldung. Habe echt keine Ahnung, woran es liegen kann. Habe es auch schon mal auf einem anderen Webspace versucht - das gleiche Resultat.

Also ihr habt auch keine Erklärung für die Fehlermeldung?

Gruß
canetti

Adwords Api: Probleme mit dem PHP-Beispiel Code

Verfasst: 02.06.2005, 09:14
von Ranking-Check
Poste mal den code

Verfasst: 02.06.2005, 12:05
von canetti
Hallo,

hier ist mal der original Google-Sample-Code:
ich habe es mit der 1.82 nusoap.php sowie der aktuellen probiert.
Funktioniert es bei euch?

Gruß canetti

<?
require_once('nusoap.php');

/* This sample program illustrates how to get traffic estimates for keywords.
This program uses nusoap.php to handle the SOAP interactions.
*/

// Set up the authentication headers
$email = "<email>xxx</email>";
$password = "<password>xxx</password>";
$userAgent = "<useragent>xxx</useragent>";
$token = "<token>xxx</token>";
$header = $email . $password . $userAgent . $token;

// Connect to the WSDL for the TrafficEstimatorService
$wsdl="https://adwords.google.com/api/adwords/ ... rvice?wsdl";
$client=new soapclient($wsdl, 'wsdl');

// Set the headers; they are needed for authentication
$client->setHeaders($header);

// With nusoap, you need to include XML with the parameters
$keyword0 = "<text>flowers</text>";
$keyword1 = "<text>chocolates</text>";
$otherinfo = "<maxCpc>50000</maxCpc><type>Broad</type>";

// Need to keep track of the order that we send in the keywords
// so we can match them to the results
$keywordTextArray[0] = "flowers";
$keywordTextArray[1] = "chocolates";

$otherinfo = "<maxCpc>50000</maxCpc><type>Broad</type>";
$keywordxml = "<KeywordRequest> $keyword0 $otherinfo </KeywordRequest><KeywordRequest> $keyword1 $otherinfo</KeywordRequest>";

// Construct the XML string for the parameters
// It's a nusoap thing that the param string needs to include the operation name too
// Specifying the namespace is optional, AdWords API web services can use the default namespace
// $param="<estimateKeywordList xmlns='https://adwords.google.com/api/adwords/v2'>" . $keywordxml . "</estimateKeywordList>";
$param="<estimateKeywordList>" . $keywordxml . "</estimateKeywordList>";

// Make the request to estimate the ikeywords
$response= $client->call("estimateKeywordList", $param);

// If the headers hadn't been set already, you'd need to provide them in the call to call()
//$response = $client->call("estimateNewAdGroup", $param, false, false, $header);

/* handle any SOAP faults. */
if ($client->fault) {
echo "<P>FAULT: {$client->fault}";
echo "<P>Code: {$client->faultcode}";
echo "<P>String: {$client->faultstring}";
echo "<P>Detail: {$client->faultdetail}";
return;
}

// If we got this far, $response contains the estimates
$count = count($response);
echo "<P>There are " . $count . " elements in the response array.";

// A single response is returned as an array of field values.
// Multiple responses are returned as an array of arrays.

if (is_array($response[0]))
{
echo "<P>We have an array of responses, need to iterate over them";
$i = 0;

while ($i < $count)
{
// Need to get the keyword text out of $keywordTextArray
// because the keywordEstimate doesn't know the keyword text
echo "<!-- keyword --><H3>" . $keywordTextArray[$i] . "</H3>";
printResults($response[$i]);
$i++;
}
}

else // only a single response
{
// echo "<H3>ONE RESPONSE</H3>";
echo "<!-- keyword text--><H3>" . $thiskeyword . "</H3>";
printResults($response);
}

function printResults ($estimate) {
echo "<blockquote>cpc " . $estimate['cpc'];
echo "<br>clicks " . $estimate['ctr'] * $estimate['impressions'];
echo "<br>ctr " . $estimate['ctr'];
echo "<br>impressions " . $estimate['impressions'];
echo "<br>notShown " . $estimate['notShownPerDay'];
echo "<br>position " . $estimate['avgPosition'];
echo "</blockquote>";
}
?>

Adwords Api: Probleme mit dem PHP-Beispiel Code

Verfasst: 02.06.2005, 12:18
von canetti
Hat sich erledigt!!!!!!!!!!!!!!

ich habe den Fehler gefunden:

$userAgent = "<useragent>PHP KeywordReport Demo</useragent>";

Diese Zeile habe ich fälschlicherweise editiert und unseren Company Name eingefügt. Daher ging es nicht!

Na super jetzt läuft es.

Danke für Eure Hilfe

canetti

Adwords Api: Probleme mit dem PHP-Beispiel Code

Verfasst: 02.06.2005, 13:27
von Southmedia
Normalerweise sollte das funktionieren... ausser du hast da ungültige Zeichen reingehauen natürlich.