ebay api

Discussion in 'PHP' started by junkmailbox53, Aug 19, 2008.

  1. #1
    Can someone help with this ebay API ...it a script with many files ... my concern is it does not seem to be passing the campaign_id to the ebay partner network ... my profile look is zero...

    ?????
    So I am not getting crediit for it ???? I guess...

    what more do I have to provide to get help

    _________________________________________
    new file

    // eBay Info (developers.ebay.com)
    $config['ebay']['rest_token'] = '6334568^*&*bnb7anY%2FpGnkmGdkL8%3D';
    $config['ebay']['user_id'] = 'bob'; // https://developer.ebay.com/devzone/account/
    $config['ebay']['total_items'] = 50;

    $config['ebay']['campaign_id'] = '123400874633'; // eBay Partner's netwotk campaign ID
    $config['ebay']['sale_id'] = ''; // tracking id
    $config['ebay']['aff_network'] = 9; // eBay Partner's netwotk
    $config['ebay']['site_id'] = 1; // US
    $config['ebay']['api_version'] = '497';


    _________________________________________
    new file



    function do_ebay($query)
    {
    global $config;

    // date & time
    $date = date(U); // format date for calculation in seconds
    $time_adjust = ($config['hour_diff'] * 60 * 60); //this is how to calc it
    $adj_time_left = date("Y-m-d", $date + $time_adjust); //format display
    $adj_time_right = date("H:m:s", $date + $time_adjust); //format display
    $end_time_from = "&end_time_from=" . $adj_time_left . "T" . $adj_time_right . ".000Z";//2008-07-05T21:20:27.000Z";

    // prepare query
    $query = urlencode($query);
    $api_url = 'http://rest.api.ebay.com/restapi?CallName=GetSearchResults&RequestToken='.$config['ebay']['rest_token'].'&RequestUserId='.$config['ebay']['user_id'].'&SiteId='.$config['ebay']['site_id'].'&Version='.$config['ebay']['api_version'].'&Query='.$query.'&EntriesPerPage='.$config['ebay']['total_items'].'&PageNumber=1&UnifiedInput=1'.$end_time_from.'&trackingpartnercode='.$config['ebay']['aff_network'].'&trackingid='.$config['ebay']['cj_publisher_id'].'&affiliateuserid='.$config['ebay']['cj_sid'];

    // curl session
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_URL, $api_url);
    $ebay_data = curl_exec($curl);
    curl_close($curl);

    // read returned xml
    $ebay_xml = new SimpleXMLElement($ebay_data);

    $list = '<dl id="ebay_items">';

    // build the items list
    if ($ebay_xml->SearchResultItemArray->SearchResultItem)
    {
    // parse the xml and and build links
    foreach ($ebay_xml->SearchResultItemArray->SearchResultItem as $searchitem) {
    $link = $searchitem->Item->ListingDetails->ViewItemURL . '&amp;pid='.$config['ebay']['cj_publisher_id'].'&amp;aid='.$config['ebay']['cj_sid'];
    $title = $searchitem->Item->Title;
    $pic = $searchitem->Item->PictureDetails->GalleryURL;

    if (empty($pic)) {
    $list .= '<dt><img src="pic.gif" alt="" /></dt>';
    } else {
    $list .= '<dt><img src="'.$pic.'" alt="" /></dt>';
    }

    $list .= '<dd><a href="'.$link.'">'.ucwords(strtolower($title)).'</a></dd>';
    $list .= '<dd class="clear"></dd>' ."\n";
    }
    }
    $list .= '</dl>';

    return $list;
    }



    _____________________________________________________
     
    junkmailbox53, Aug 19, 2008 IP
  2. webboy

    webboy Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if you hard code the tracking id does it work ?

    as i have used the ebay example and it works fine
     
    webboy, Aug 20, 2008 IP
  3. junkmailbox53

    junkmailbox53 Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I am not sure what I am missing. However as the site is running it is not passing details to ebay

    see example:


    http://gizbuilder.com/test2/

    thanks for your help.

    can you look at the site?

    I paid a lot of money for the site/code
     
    junkmailbox53, Aug 20, 2008 IP
  4. William[ws]

    William[ws] Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Do
    echo $api_url;

    and make sure all values are correct
     
    William[ws], Aug 20, 2008 IP
  5. webboy

    webboy Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i see you have CJ coding also here, I dont that will work as its now all ebay not CJ anymore
     
    webboy, Aug 20, 2008 IP
  6. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #6
    you're not sending your campaign id to the api. from what i can see anyways.. im currently working with the ebay api myself however i'm using rss.ebay.com instead of rest.ebay.com but i send my campaign id as afepn=CAMPAIGN_ID in the url. dunno if this will help or not but it's what i do.
     
    ansi, Aug 20, 2008 IP
  7. junkmailbox53

    junkmailbox53 Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    webboy, where? ...what line

    William[ws] ...where?/
    echo $api_url;
    and make sure all values are correct
     
    junkmailbox53, Aug 20, 2008 IP
  8. William[ws]

    William[ws] Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    right after
    add exit();
    after the echo command and see whats your output
    
    $api_url = 'http://rest.api.ebay.com/restapi?CallName=GetSearchResults&RequestToken='.$config['ebay']['rest_token'].'&RequestUserId='.$config['ebay']['user_id'].'&SiteId='.$config['ebay']['site_id'].'&Version='.$config['ebay']['api_version'].'&Query='.$query.'&EntriesPerPage='.$config['ebay']['total_items'].'&PageNumber=1&UnifiedInput=1'.$end_time_from.'&trackingpartnercode='.$config['ebay']['aff_network'].'&trackingid='.$config['ebay']['cj_publisher_id'].'&affiliateuserid='.$config['ebay']['cj_sid'];
    
    Code (markup):
     
    William[ws], Aug 20, 2008 IP
  9. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #9
    again, the only time that the campaign id is used (in the code that you showed us) is in the settings where $config['ebay']['campaign_id'] is set.
     
    ansi, Aug 20, 2008 IP