1. Go to this page and download the library: Download jxlau/meituan-pub-union 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/ */
jxlau / meituan-pub-union example snippets
use GaoweiSpace\MeituanPubUnion\Api\Common\Request\CitiesRequest;
use GaoweiSpace\MeituanPubUnion\Http\Client;
$app_key = 'xxxxxxxxxx';
$utm_source = 'xxxxxxxxxx';
// 实例化获取城市的请求类
$request = new CitiesRequest();
// 设置省份ID
$request->setProvinceId(1);
// 实例客户端类
$client = new Client($app_key, $utm_source);
// 发送请求调用接口
$response = $client->syncInvoke($request);
public function setUtmSource(string $utmSource): void
{
$this->utmSource = $utmSource;
}