Hi,

I got a response back, but when the simplexml_load_string () function
I'm using is not getting the value back!
What could be the problem? Please help!

<?php
$xml = '
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
        <soap:Header>
                <ResponseHeader 
xmlns:ns2="https://adwords.google.com/api/adwords/cm/
v201109" xmlns="https://adwords.google.com/api/adwords/o/v201109";>
                        <ns2:requestId>***</ns2:requestId>
                        <ns2:serviceName>AccountService</ns2:serviceName>
                        <ns2:methodName>get</ns2:methodName>
                        <ns2:operations>5</ns2:operations>
                        <ns2:responseTime>1164</ns2:responseTime>
                        <ns2:units>6</ns2:units>
                </ResponseHeader>
        </soap:Header>
        <soap:Body>
                <getResponse 
xmlns:ns2="https://adwords.google.com/api/adwords/cm/
v201109" xmlns="https://adwords.google.com/api/adwords/o/v201109";>
                        <rval>
                                <totalNumEntries>800</totalNumEntries>
                                <entries>
                                        <data>
                                                <key>CRITERION</key>
                                                <value 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:type="CriterionAttribute">
                                                
<Attribute.Type>CriterionAttribute</Attribute.Type>
                                                        <value 
xsi:type="ns2:Keyword">
                                                                
<ns2:Criterion.Type>Keyword</ns2:Criterion.Type>
                                                                
<ns2:text>honlap f1d61771</ns2:text>
                                                                
<ns2:matchType>BROAD</ns2:matchType>
                                                        </value>
                                                </value>
                                        </data>
                                        <data>
                                                
<key>AVERAGE_TARGETED_MONTHLY_SEARCHES</key>
                                                <value 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:type="LongAttribute">
                                                        
<Attribute.Type>LongAttribute</Attribute.Type>
                                                        <value>246000</value>
                                                </value>
                                        </data>
                                </entries>
                        </rval>
                </getResponse>
        </soap:Body>
</soap:Envelope>
';

$xmlstr = trim($xml);
$objdata = simplexml_load_string($xmlstr);

$objdata->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/
soap/envelope/');
$objdata->registerXPathNamespace('ns2', 'https://adwords.google.com/
api/adwords/cm/v201109');
$objdata->registerXPathNamespace('xsi', 'http://www.w3.org/2001/
XMLSchema-instance');

foreach ($objdata->xpath('//soap:Envelope/soap:Body/getResponse/rval/
entries') as $keywords)
{
    print_r($keywords);
}
?>

Thanks.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to