Skip to content

Instantly share code, notes, and snippets.

@man4toman
Created October 1, 2018 10:06
Show Gist options
  • Save man4toman/f6a5ecb01fdfe1ea92c7658adb1c1025 to your computer and use it in GitHub Desktop.
Save man4toman/f6a5ecb01fdfe1ea92c7658adb1c1025 to your computer and use it in GitHub Desktop.
Download .crx Chrome Extension file with PHP
<?php
if(isset($_POST["submit"])){
if(isset($_POST["url"]) && filter_var($_POST["url"], FILTER_VALIDATE_URL)){
//Get extension id
$pos = strrpos($_POST["url"], '/');
$end = $pos === false ? $_POST["url"] : substr($_POST["url"], $pos + 1);
$id = substr($end, 0, strpos($end, "?"));
$durl = "https://clients2.google.com/service/update2/crx?response=redirect&x=id%3D".$id."%26uc&prodversion=32";
//Simply get!
header("Location: $durl");
exit;
}
}
?>
<form method="post">
<input type="text" name="url">
<input type="submit" name="submit" value="Download crx!">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment