PHP code example of jubull / pinduoduo

1. Go to this page and download the library: Download jubull/pinduoduo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jubull / pinduoduo example snippets



use \Justmd5\PinDuoDuo\PinDuoDuo;

xxxxxx69e3940c6b93xxxxxx',
    'client_secret' => 'c2eda0c398xxxxxxbd63ff57bf22c05xxxxxx',
    'debug'              => true,
    'member_type'        => 'JINBAO',//用户角色 :MERCHANT(商家授权),H5(移动端),多多客(JINBAO),
    'redirect_uri'       => 'https://test.xxx.com/callback',
    'log'                => [
        'name'       => 'pinduoduo',
        'file'       => __DIR__ . '/pinduoduo.log',
        'level'      => 'debug',
        'permission' => 0777,
    ],
];
$pinduoduo = new PinDuoDuo($config);


$result   = $pinduoduo->api->request('pdd.ddk.goods.detail', ['goods_id_list' => ['395581006']]);


$url = $pinduoduo->pre_auth->authorizationUrl();

$pinduoduo->pre_auth->authorizationRedirect();

$token = $pinduoduo->pre_auth->getAccessToken();
//也可以通过上面得到的 refresh_token 去刷新令牌
//$token = $pinduoduo->pre_auth->refreshToken($token['refresh_token']);

$pinduoduo = $pinduoduo->oauth->createAuthorization($token['token']);

$result   = $pinduoduo->auth_api->request('pdd.ddk.oauth.goods.pid.query');