Skip to content

Instantly share code, notes, and snippets.

@billionaire
Last active January 15, 2020 20:01
Show Gist options
  • Select an option

  • Save billionaire/b8ae02ac53feaeb8decf to your computer and use it in GitHub Desktop.

Select an option

Save billionaire/b8ae02ac53feaeb8decf to your computer and use it in GitHub Desktop.
Google Chrome Data Compression Proxy [php, curl]
<?php
var_dump(curlGetViaGoogleProxy('http://4ip.pw/'));
function curlGetViaGoogleProxy($url, $post = '', $cookie = '') {
$timestamp = time();
$authValue = 'ac4500dd3b7579186c1b0620614fdb1f7d61f944'; // via http://superuser.com/a/959419
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, 'compress.googlezip.net:80');
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_ENCODING , '');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Chrome-Proxy: ps='.$timestamp.'-'.rand(1000000000, 9999999999).'-'.rand(1000000000, 9999999999).'-'.rand(1000000000, 9999999999).', sid='.md5($timestamp.$authValue.$timestamp).', b=2623, p=87, c=win',]);
if ($post) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($post)?http_build_query($post):$post);
}
if ($cookie) {
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
$raw_data = curl_exec($ch);
curl_close($ch);
return $raw_data;
}
@Zibri
Copy link
Copy Markdown

Zibri commented Dec 9, 2018

it does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment