Category Archives: Php

How to write to Google Sheet with API in PHP

  1. Get a service account key from https://console.cloud.google.com/apis/credentials (You can here also restrict what this keys is allowed todo)
    1. When creating, make sure you click the Furnish a new private key
    2. Select JSON when it asks you how to download the key.
  2. The service account key you have just generated includes a client_email.
    1. Go to you google spreadsheet and allow this client_email to have write access on this document

https://stackoverflow.com/questions/44045183/access-google-spreadsheet-api-without-auth-token

Excel Compatible Partnumbers

WHMCS Oauth userinfo.php not working

I was trying to incorporate SSO in Freshdesk with WHMCS, but because WHMCS requires passing a query parameter = access_token instead of using the Authorization header, this is what you need to do to make it work.

1. Reveal Authorization Header in .htaccess

2. Use your own oauth-intermediary.php where you take the header and send the query parameter that WHMCS is expecting

3. User your new https://www.yousite.com/oauth-intermediary.php as the new userinfo.php URL when requested

Loop Spreadsheet and Update image height/width

M2E additional columns in grid