Lets say you have a PHP script that returns a value, based on a query string: Getting the result of that PHP script into Google Sheets is rather easy. Open Tools > Script Editor in Google Sheets and create a function like this: function getMyQueryValue(value) { var response = UrlFetchApp.fetch(“https://mysite.com.com/query.php?string=” + value); Logger.log(response.getContentText()); return JSON.parse(response); […]
Tag: php
Self hosted Dynamic DNS / No-IP script with Route53
Here’s a quick PHP script to throw up onto an EC2 instance that will allow you to manage your own basic dynamic DNS entries. https://gist.github.com/dtbaker/01f7c6e50d20ba8bb290083d74b9128b
Yoast SEO really slow in WordPress backend Edit Page area
So Yoast SEO was running REALLY slow, like 2 minutes slow. Turns out it renders page content via wp_ajax and then parses this content via javascript. This is very problematic if a certain shortcode renders lots of content on the frontend (in my case it was a job board/map search shortcode thing). A quick fix is […]
php_network_getaddresses: getaddrinfo failed: Name or service not known
If your PHP script is reporting this error (or generally unable to connect to hosts) then you may need to restart Apache/PHP-FPM/Entire Server after a recent glibc security update. More details: https://twitter.com/rossey/status/844857622230556672
How to run PhantomJS from PHP
I was adding PhantomJS into an existing PHP script and running passthru(‘phantomjs …..’); just wasn’t working. A few tips: If you’re running the script locally, add export DISPLAY=:0 to the PHP passthru() If you’re running the script on a remote host make sure someting like Xvfb is installed, then run nohup Xvfb :40 -ac -screen 0 1600x4000x24 & […]
Adding extra fields to an existing Elementor widget
Following on from creating your own Elementor widgets it is possible to add extra fields to existing widgets. Again there are no hooks or filters for this, we’ll be interacting with the Elementor class directly. View this gist on GitHub Pretty easy.
Upgrading from mysql_connect() to mysqli_connect()
It’s pretty smooth to upgrade from the old mysql to the new mysqli functions in PHP. Most of them are the same, and documented well on the php.net website. However if you’re clients have configured database server names back in mysql_connect() days then they may have added the port number or socket to the mysql […]