Author Archive



29
Jun

PHP Tutorial – Forking using wget or php cli in the background

I see a lot of people asking on how to use a fork to run a php script or web page in the background.

Here’s a quick script I created using linux’s wget to run another process in the background. You could use this to automatically upload something to another server, or just about anything that needs to happen after a user action.

Note: you must have exec enabled for this to work. This is a security risk, so make sure you know the potential damage that can be done by enabling exec, and by the script that you are running. Make absolutely sure to sanitize any input being transferred to the executed script.

In my case, I needed to initiate a file upload to a remote server after a certain action was taken. Because of the nature of the upload, it would have taken about 30 seconds before displaying any response to my user, which is an unacceptable delay.

First, make the script that needs to run in the background.

Click to continue…

29
Jun

**UPDATED** Adding Google Business search to your ecommerce website

**UPDATED**
This is an updated version of the script. It now resides on only a single page and should be less confusing to put into a website. Please feel free to use this script as a base and customize as you like.

Sign up for a business site search account here: http://www.google.com/sitesearch/index.html

The internet is abuzz with news of Google’s new business custom search engine. Google is allowing business sites to have their own custom search engine for $100 per year (<5,000 pages) or $500 per year (up to 50,000) pages. This includes some cool reporting and an XML API so that you can customize to your heart’s content.

Google Custom Search

After messing around with Google’s javascript code I decided to write my own little script to better integrate it into my website. The javascript code was giving me some major problems with the width of my pages, so I canned it and went to their XML version of the search function.

The following is a very simple php & html script that you can use for your own Google business search engine. It was made for a php5 server as it uses the built-in simpleXML class. Upload this to your website, enter your account id, and make a form to post to it. That’s it!

Click to continue…

Copyright © 2024 SayNoToFlash, Jamie Estep, All Rights Reserved · Theme design by Themes Boutique