Category: apis

  • Running a PHP script with a Cron job in 1and1

    Following on from running my first cron job with 1and1 hosting what I really wanted to do was to be able to run a php script, perl script or some other form of script on a timed basis. This article is a description of setting up a cron job on 1and1 hosting to run a simple “hello world” style example.

    First I set up my helloworld.php script, this was a simple script to create a file called helloworld.txt and write the words “hello world” to that file and save it.

    I tested this file by running it on my server and it worked fine. The next thing I had to do was log on to my 1and1 server using SSH, the program I use for this is PuTTY which I have been using since university and works well. The next two steps you have to go through are: 1. to find the location of your current directory: enter “pwd” to find this. 2. to find the location of php on your machine.

    Now I had to create my crontab file. So I entered the command “crontab -e” (which means edit crontab) and came to the VI editor. Using this command I found that on 1and1 hosting my helloworld.txt file was updated between 14 and 18minutes past every hour.

    I know this description would have helped me had it been available when I was looking for information on running a php file through a cron job on 1and1. I hope it helps you.

    Get my marketing cheat sheets at Click Here
  • PHP mySQL close connection

    So I have been creating lots of new features for me to maintain my cocktail making website. One feature has involved me setting up a new mySQL 5.0 database (with cool stored procedures I am only starting to understand now) in order to do some tracking of what is happening on the site and with my widget. This has required me to use two databases at once for the first time. One to check if a user is signed in with admin rights and the other to check the tracking out of the other database (php security is really tricky so I am slightly nervous posting even this here :s ).

    However I did want to note how you close a connection with a mysql database using PHP in order to open one with another mysql database since it’s really simple but I found it hard to get info. So when you open databases try closing them, I know I will in future for good practice, it makes everything much simpler if you add another database at a later stage.

    Get my marketing cheat sheets at Click Here
  • Graphing Search Result Numbers Over Time

    So I have had a random idea for a little project that could be fun. We all know about Google Trends, eBay Pulse, the Overture Search Suggestion tool. Now I think all of these are truly amazing tools. Something we don’t neccessarily know about is the supply side of this equation. All of a sudden that is really interesting me. It would be relatively simple to set up a CRON job that runs once daily and pulls the abundance through the various API’s available. It could also be really fun to see how trends shift over time (perhaps looping in Technorati and a couple of other sources). It could even be a fun tool for an eBay seller to help me monetize it a little bit… hmm I think I may build this at the weekend and if I do I will post the resulting graphs on this blog as well as on a little site I recently purchased with 1 and 1. YAY!

    Get my marketing cheat sheets at Click Here
  • How to use the Typepad Widget API with PHP

    The Typepad Widget API is awesome. The concept is that you have a great widget you want users to add to their sidebar. Typepad want this to be a small self contained piece of DHTML code and want to be able to do all the verification of the user on their side without giving the widget owner any access to the user’s account.

    Browser based authentication used at both the eBay and Yahoo! developer programs (and explained beautifully in diagram form on the Yahoo! site) simply won’t work for this since it gives the programmer access to your eBay/Yahoo/Typepad account (were they to use it). So Typepad found a solution to the problem that is really simple and elegant.

    All data is sent to the API in a POST command along with redirecting the user themselves (rather than just a server to server POST call). Typepad’s Widget API requires fields identifying you as a developer, your application, what it is called, verifying you are who you say you are (with a token) and finally containing the FULL HTML you want inserted in the user’s sidebar to be sent to them through the POST command.

    The user then lands at a Typepad log in page and all the data is carried through with them to a page where they can effectively suggest whether or not to keep the Typepad widget. GREAT!

    I love this method, it’s secure, clever, simple and behaves exactly as you would expect… Having worked with Google AdWords/Base/Adsense APIs, Yahoo! APIs, eBay APIs and a fair few others I have to say this Typepad Widget API has been the simplest yet. Well done Typepad!

    Get my marketing cheat sheets at Click Here
  • flickr typepad widget

    Today I finished my second widget for the typepad developer program, am really proud of and pleased with it. I am however always looking for comments and suggestions for improvement so if anyone has any… let me know 😉

    Get my marketing cheat sheets at Click Here
  • del.icio.us typepad widget finished

    Today I finished my first widget for the typepad developer program, am really proud of and pleased with it. I am however always looking for comments and suggestions for improvement so if anyone has any… let me know 😉

    Get my marketing cheat sheets at Click Here
  • del.icio.us API working PHP code for Https v1

    So I was very frustrated when all of a sudden my del.icio.us api tag cloud stopped working. I managed today to find out why – del.icio.us have a highly secret blog which warned everyone their del.icio.us app would break if they didn’t wake up and smell the SSL.

    So today I put together an SSL application for V1 of the del.icio.us https api using PHP. You need to create your URL to call, then throw together your CURL call to the API which is needed to connect via CSS and also send the user agent that del.icio.us requires from you.

    Now you should find that your API content is contained in the $xml variable and you can enjoy translating it via the XSL tool of your choice.

    Get my marketing cheat sheets at Click Here