问题描述
我正在尝试在 akamai fast purge 中进行 Post Call,但只显示此响应:
Warning: file_get_contents(https://akab-***********.luna.akamaiapis.net/ccu/v3/invalidate/url/production): Failed to open stream: HTTP request Failed! HTTP/1.0 411 Length required in C:\xampp\htdocs\akamaiCache\gitTest\tests\test.PHP on line 30
我的代码如下所示:
include 'akamai-open-edgegrid-client-1.0.0.phar';
require_once 'src/Authentication.PHP';
require_once 'src/Authentication/Timestamp.PHP';
require_once 'src/Authentication/Nonce.PHP';
require_once 'src/Authentication/Exception.PHP';
require_once 'src/Authentication/Exception/ConfigException.PHP';
require_once 'src/Authentication/Exception/SignerException.PHP';
require_once 'src/Authentication/Exception/SignerException/InvalidSignDataException.PHP';
$auth = \Akamai\Open\EdgeGrid\Authentication::createFromEdgeRcFile('default','.edgerc');
//$auth->setHttpMethod('PUT');
$auth->setPath('/ccu/v3/invalidate/url/production');
$context = array(
'http' => array(
'method' => 'POST','header' => array(
'Authorization: ' . $auth->createAuthHeader(),'Content-Type: application/json'
)
)
);
$context = stream_context_create($context);
$response = json_decode(file_get_contents('https://' . $auth->getHost() . $auth->getPath(),null,$context));
?>
在网上搜索没有给我任何提示,邮递员的发布请求效果很好。我什至试图复制邮递员代码片段并使用它,但它使问题变得更糟。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)