Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-19-2007, 02:38 PM   #1 (permalink)
oskare100
Junior Member
 
Join Date: Dec 2006
Posts: 4
Default XML/PHP API Question! Solved one part need help with selecting!

Hello,
I've managed to recieve all messages from Ebay within the data range I specified with the call GetMemberMessages (GetMemberMessages - Version 507) but I have one problem left I really need help with.

Here is the code I used:
PHP Code:
<?php   
include('functions.php');
include(
'variables.php');
error_reporting(E_ALL);
ini_set('display_errors''1');
    
//SiteID must also be set in the Request's XML
    //SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
    //SiteID Indicates the eBay site to associate the call with
    
$siteID 0;
    
//the call being made:
    
$verb 'GetMemberMessages';
    
//Regulates versioning of the XML interface for the API
    
$compatabilityLevel 433;

    
//get an array of strings containing the required headers
    
$headers buildEbayHeaders($devID$appID$certID$compatabilityLevel$siteID$verb);

    
// Time from and time to
    
$time_from date('Y-m-d\TH:i:s',strtotime("-10 days")).'.799Z';
    
$time_to date('Y-m-d\TH:i:s',strtotime("+ 1 day")).'.799Z';
    
    
///Build the request Xml string
    
$requestXmlBody '<?xml version="1.0" encoding="utf-8">';
    
$requestXmlBody .= '<GetMemberMessagesRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
    
$requestXmlBody .= "<RequesterCredentials><eBayAuthToken>$userToken</eBayAuthToken></RequesterCredentials>";
    
$requestXmlBody .= "<MailMessageType>All</MailMessageType>";
    
$requestXmlBody .= "<EndCreationTime>$time_to</EndCreationTime>";
    
$requestXmlBody .= "<StartCreationTime>$time_from</StartCreationTime>";
    
$requestXmlBody .= '</GetMemberMessagesRequest>';
    
    
$responseXml sendHttpRequest($requestXmlBody$serverUrl$headers);
    if(
stristr($responseXml'HTTP 404') || $responseXml == '')
        die(
'<P>Error sending request');
    
    
//Xml string is parsed and creates a DOM Document object
    
$responseDoc domxml_open_mem($responseXml);
    
    
//get any error nodes
    
$errors $responseDoc->get_elements_by_tagname('Errors');
    
    
//if there are error nodes
    
if(count($errors) > 0)
    {
        echo 
'<P><B>eBay returned the following error(s):</B>';
        
//display each error
        //Get error code, ShortMesaage and LongMessage
        
$code $errors[0]->get_elements_by_tagname('ErrorCode');
        
$shortMsg $errors[0]->get_elements_by_tagname('ShortMessage');
        
$longMsg $errors[0]->get_elements_by_tagname('LongMessage');
        
//Display code and shortmessage
        
echo '<P>'$code[0]->get_content(), ' : 'str_replace(">""&gt;"str_replace("<""&lt;"$shortMsg[0]->get_content()));
        
//if there is a long message (ie ErrorLevel=1), display it
        
if(count($longMsg) > 0)
            echo 
'<BR>'str_replace(">""&gt;"str_replace("<""&lt;"$longMsg[0]->get_content()));

    }
    else 
//no errors
    
{
     
//get results nodes
    
$itemNodes $responseDoc->get_elements_by_tagname('MemberMessage');
    
    foreach(
$itemNodes as $item){
    
$message $item->get_elements_by_tagname('MemberMessageExchange');
                {
                
//display all the elements of each item
                
foreach($item->child_nodes() as $itemChild)
        echo 
$itemChild->get_content();
        
            }
    
    
    }
    
    }
?>

The problem is that when I run that code I get all information back - everything - item numbers, emails, questions and everything else. I've no idea of how to select the information I want to use. That's what I really need help with.

I tried to use echo $itemChild->get_content('SenderEmail'); to get only the sender email but it didn't work, I still got everything back. I'm really greatful for any help I can get.

Thanks in advance,
Oskar R
oskare100 is offline   Reply With Quote
Sponsored Links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 05:50 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums