PHP code example of crmeb / yihaotong

1. Go to this page and download the library: Download crmeb/yihaotong 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/ */

    

crmeb / yihaotong example snippets

regexp


use Crmeb\Yihaotong\AccessToken;
use Crmeb\Yihaotong\Factory;
use think\facade\Cache;

 $accessToken = app()->make(AccessToken::class, [
        [
            'access_key' => '',
            'secret_key' => '',
        ],
        Cache::store('redis')->handler()
    ]);
  
  
 $url = '采集商品的url地址';
 $factory = Factory::setAccessToken($accessToken);
 $res = $factory->collet()->goods($url);

regexp

laravel8.*中使用


use Crmeb\Yihaotong\AccessToken;
use Crmeb\Yihaotong\Factory;
use Illuminate\Support\Facades\Cache;

 $accessToken = app()->make(AccessToken::class)
                ->setConfig('access_key','secret_key')
                ->setCache(Cache::store('redis'));
  
 $url = '采集商品的url地址';
 $factory = Factory::setAccessToken($accessToken);
 $res = $factory->collet()->goods($url);