方便测试,展示不用CDN加速

ct-mobile-first
ycc 5 years ago
parent 1541a2dd69
commit 66afd50df0

@ -18,7 +18,7 @@
* Note that in order for this to work you need to provision credentials
* specifically for CCU - you cannot extend existing credentials to add
* CCU as it's managed under "CCU" in the API credential system.
*
*
* Configure->Organization->Manage APIs
* Select "CCU APIs"
* Create client collections/clients
@ -26,53 +26,54 @@
*
* Put the credentials in ~/.edgerc as demonstrated by api-kickstart/sample_edgerc
*/
namespace Akamai\Open\Example;
require_once __DIR__ . '/cli/init.php';
class CcuClient
{
/**
* @var \Akamai\Open\EdgeGrid\Client
*/
protected $client;
/**
* @var \Akamai\Open\EdgeGrid\Client
*/
protected $client;
public function __construct()
{
$this->client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile('ccu');
public function __construct()
{
$this->client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile('ccu');
}
}
public function postPurgeRequest($hostname, $objects)
{
$purge_body = [
'objects' => $objects
];
$response = $this->client->post('/ccu/v3/invalidate/url', [
'body' => json_encode($purge_body),
'headers' => ['Content-Type' => 'application/json']
]);
return $response;
}
public function postPurgeRequest($hostname, $objects)
{
$purge_body = [
'objects' => $objects
];
$response = $this->client->post('/ccu/v3/invalidate/url', [
'body' => json_encode($purge_body),
'headers' => ['Content-Type' => 'application/json']
]);
return $response;
}
}
$ccu = new CcuClient();
$url = $_POST['url'];
echo $url;die();
try {
$objects = [
$url
];
$objects = [
$url
];
$purge = $ccu->postPurgeRequest('data.chinarundreisen.com', $objects);
$response = json_decode($purge->getBody());
if($response->httpStatus == 201){
echo '{"msg":"success"}';
}else{
echo json_encode($response);
}
$purge = $ccu->postPurgeRequest('data.chinahighlights.com', $objects);
$response = json_decode($purge->getBody());
if ($response->httpStatus == 201) {
echo '{"msg":"success"}';
} else {
echo json_encode($response);
}
} catch (\GuzzleHttp\Exception\ClientException $e) {
header("status: 404 not found");
echo "An error occurred: " .$e->getMessage(). "\n";
header("status: 404 not found");
echo "An error occurred: " . $e->getMessage() . "\n";
}

@ -19,7 +19,7 @@
<link rel="dns-prefetch" href="//www.google-analytics.com">
<link rel="dns-prefetch" href="//connect.facebook.net">
<link rel="dns-prefetch" href="//www.facebook.com">
<link href="https://data.chinahighlights.com/css/mobile-first.css?v=123" rel="stylesheet">
<link href="https://proxy-data.chinahighlights.com/css/mobile-first.css?v=123" rel="stylesheet">
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

@ -8,7 +8,7 @@
<link rel="canonical" href="<!--@CANONICAL@-->">
<meta content="width=device-width,minimum-scale=1,initial-scale=1" name="viewport">
<link rel="shortcut icon" href="//data.chinahighlights.com/favicon.ico">
<link href="https://data.chinahighlights.com/css/mobile-first.css?v=321" rel="stylesheet">
<link href="https://proxy-data.chinahighlights.com/css/mobile-first.css?v=321" rel="stylesheet">
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

Loading…
Cancel
Save