Closed ss84bhaskar closed 6 years ago
Any help me to guide how i can purge AMP Cache for AMP URL?
Following is the code:
error_reporting(E_ALL); ini_set("display_errors", 1);
function urlsafe_b64encode($string) { return strreplace(array('+','/','='),array('-','',''), base64_encode($string)); }
$ampBaseUrl = "https://m-bhaskar-com.cdn.ampproject.org";
$signatureUrl = '/update-cache/c/s/m.bhaskar.com/amp/jharkhand/ranchi/news/JHA-RAN-HMU-LCL-infog-fodder-scam-lalu-prasad-yadav-including-19-convicts-will-announce-punishment-5836446-PHO.html?amp_action=flush&_ts='.time();
// opening the private key $pkeyid = openssl_pkey_get_private("file:///disk2/v/apache/htdocs/VIRTUAL/domains/www.bhaskar.com/public_html/.well-known/amphtml/apikey.pem");
// generating the signature openssl_sign($signatureUrl, $signature, $pkeyid);
// urlsafe base64 encoding $signature = urlsafe_b64encode($signature);
// final url for updating echo $ampUrl = $ampBaseUrl.$signatureUrl."&_url_signature=".$signature;
After Executing it gives Warning: openssl_sign(): supplied key param cannot be coerced into a private key
Unsure how this is related to xmlseclibs.
Any help me to guide how i can purge AMP Cache for AMP URL?
Following is the code:
error_reporting(E_ALL); ini_set("display_errors", 1);
function urlsafe_b64encode($string) { return strreplace(array('+','/','='),array('-','',''), base64_encode($string)); }
$ampBaseUrl = "https://m-bhaskar-com.cdn.ampproject.org";
$signatureUrl = '/update-cache/c/s/m.bhaskar.com/amp/jharkhand/ranchi/news/JHA-RAN-HMU-LCL-infog-fodder-scam-lalu-prasad-yadav-including-19-convicts-will-announce-punishment-5836446-PHO.html?amp_action=flush&_ts='.time();
// opening the private key $pkeyid = openssl_pkey_get_private("file:///disk2/v/apache/htdocs/VIRTUAL/domains/www.bhaskar.com/public_html/.well-known/amphtml/apikey.pem");
// generating the signature openssl_sign($signatureUrl, $signature, $pkeyid);
// urlsafe base64 encoding $signature = urlsafe_b64encode($signature);
// final url for updating echo $ampUrl = $ampBaseUrl.$signatureUrl."&_url_signature=".$signature;
After Executing it gives Warning: openssl_sign(): supplied key param cannot be coerced into a private key