在 eBay API 调用中更改站点 ID


change siteid in ebay API call

我需要使用 openbay 中的函数与 eBay 电机站点连接,这是一个 opencart 扩展。eBay 电机的站点 ID 是 100,但对于我的生活,我无法让它随着这个函数的编写方式而改变,我在这里错过了什么吗???

API function call

public function openbay_call($call, array $post = NULL, array $options = array(), $content_type = 'json', $statusOverride = false){
        if(defined("HTTPS_CATALOG")){
            $domain = HTTPS_CATALOG;
        }else{
            $domain = HTTPS_SERVER;
        }
        $data = array(
            'token'             => $this->token, 
            'language'          => $this->config->get('openbay_language'), 
            'secret'            => $this->secret, 
            'server'            => $this->server, 
            'domain'            => $domain, 
            'openbay_version'   => (int)$this->config->get('openbay_version'),
            'data'              => $post, 
            'content_type'      => $content_type
        );
       $defaults = array(
            CURLOPT_POST            => 1,
            CURLOPT_HEADER          => 0,
            CURLOPT_URL             => $this->url.$call,
            CURLOPT_USERAGENT       => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1",
            CURLOPT_FRESH_CONNECT   => 1,
            CURLOPT_RETURNTRANSFER  => 1,
            CURLOPT_FORBID_REUSE    => 1,
            CURLOPT_TIMEOUT         => 0,
            CURLOPT_SSL_VERIFYPEER  => 0,
            CURLOPT_SSL_VERIFYHOST  => 0,
            CURLOPT_POSTFIELDS      => http_build_query($data, '', "&")       
        );
        $ch = curl_init();
        curl_setopt_array($ch, ($options + $defaults));
        if( ! $result = curl_exec($ch)){
            $this->log('openbay_call() - Curl Failed '.curl_error($ch).' '.curl_errno($ch));
        }
        curl_close($ch);
        /* There may be some calls we just dont want to log */
        if(!in_array($call, $this->noLog)){
            $this->log('openbay_call() - Result of : "'.$result.'"');
        }
        /* JSON RESPONSE */
        if($content_type == 'json'){
            $encoding = mb_detect_encoding($result);
            /* some json data may have BOM due to php not handling types correctly */
            if($encoding == 'UTF-8') {
              $result = preg_replace('/[^('x20-'x7F)]*/','', $result);    
            } 
            $result             = json_decode($result, 1);
            $this->lasterror    = $result['error'];
            $this->lastmsg      = $result['msg'];
            if(!empty($result['data'])){
                return $result['data'];
            }else{
                return false;
            }
        /* XML RESPONSE */
        }elseif($content_type == 'xml'){
            $result             = simplexml_load_string($result);
            $this->lasterror    = $result->error;
            $this->lastmsg      = $result->msg;
            if(!empty($result->data)){
                return $result->data;
            }else{
                return false;
            }
        }
    }else{
        $this->log('openbay_call() - OpenBay not active');
        $this->log('openbay_call() - Data: '.serialize($post));
    }
}

predefined parameters within the class - 可能无济于事,但无论如何都包括在内。

public function __construct($registry) {
    $this->registry     = $registry;
    $this->token        = $this->config->get('openbaypro_token');
    $this->secret       = $this->config->get('openbaypro_secret');
    $this->logging      = $this->config->get('openbaypro_logging');
    $this->tax      = $this->config->get('tax');
    $this->server       = 1;
    $this->lasterror    = '';
    $this->lastmsg      = '';
}

the function call

$this->data['test_category_features'] = $this->ebay->openbay_call('listing/getCategoryFeatures/', array('id' => 35618));
一切正常,但是我

如何让它将siteid更改为100,我能弄清楚的唯一方法是重写我自己的API调用类,但是客户端正在支付openbay的订阅费用并希望通过它们使用API调用,所以我必须使用那里的功能。我试图返回eBay电机类别的功能,以便他可以像多年来"二手零件"一样列出它们。如果您不切换到 eBay 电机站点 ID "100",那么在尝试通过 opencart 扩展将产品添加到 eBay 时,它将不会返回所需的类别变体,或者更少接受类别。任何建议将不胜感激,真的卡在这里!!提前致谢:)

根据

此页面:http://developer.ebay.com/DevZone/merchandising/docs/Concepts/SiteIDToGlobalID.html 您需要添加"...每个 API 调用的 X-EBAY-SOA-GLOBAL-ID HTTP 标头",因此将其添加到 curl 选项中。