Skip to content

Google Script (Document, Sheets, ...) shares their IP addresses when doing calls to external hosts. This super simple php script allows users to use any webserver's IP address to do proxied requests without running in any IP restrictions/limitations.

License

Notifications You must be signed in to change notification settings

TechupBusiness/google-script-php-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Simple ugly proxy for Google Apps Scripts (in PHP)

This script was created for a Crypto-Currency Portfolio Tracking Sheet. But you can use it for any Google Drive file that is requesting data from an API (REST, etc.) which is limited to certain requests per IP.

Simply set you token and proxy URL and request data via the following method:

function fetchUrl(url) {
  var finalUrl;

  var proxyUrl = 'http://api.yourdomain.com/proxy.php'; // TODO Enter the complete URL to your proxy script e.g. 
  var proxyToken = ''; // TODO Enter your token
   
  if(proxyUrl==='') {
    finalUrl = url;
  } else {
    finalUrl = proxyUrl + "?url=" + encodeURIComponent(url) + "&token=" + encodeURIComponent(proxyToken); 
  }
  
  var response = UrlFetchApp.fetch(finalUrl);
  var returnText = response.getContentText();
  return returnText;
}

You can use it like:

  var returnText = fetchUrl('https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=BTC,USD,EUR');
  
  // Do anything with your web request result like parsing it if it's JSON....:
  var parsedData = JSON.parse(returnText);

About

Google Script (Document, Sheets, ...) shares their IP addresses when doing calls to external hosts. This super simple php script allows users to use any webserver's IP address to do proxied requests without running in any IP restrictions/limitations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages