Headless SEO Tool

on

There are many types of SEO tools that are utilized. Depending on the objectives, you may use a particular tool to look up a keyword or maybe to expand on the keywords. Or maybe you’re looking to see what your competitors Social Media presences looks like.  No matter what you’re using some sort of tool to look up something or as part of a distilled  process.

The purpose of this post is about creating a simple headless SEO tool that I’ve been working on that pulls information quickly about a web page. This is an agile tool, its not built out to be a robust tool, its specific to what I need to look up.

Objectives

Before we talk about specifics of the tools, we need to define what the objectives are. Are we just looking up a keyword to see how many competing websites, or are we trying to conduct a site audit? There is no one tool that does it all, unless its custom made for your multi-purpose. For the focus of this article, we will look at an agile  tool with a main function of looking up a specific thing, such as the meta data of a web page. Meta data is the information in the backend of a web page, usually located withing the header tag, ie <head>….</head>

This specific tool is initiated from the command line interface. In this article, I’m going to assume:

  • That you’re on a Window 7 Operating System (other OS’s are fine, I’m on Window 7)
  • Have PHP 5 + installed on your system.
  • You know how to bring up the CLI (command line interface, cmd)
  • You know PHP programming (beginner to intermediate level, ability to read & write the code)

Benefits of This Agile Tool

  • Quick look Up
  • Headless Web – means you don’t have to open your web browser.
  • You can code your script to do almost anything from simple meta lookups to DOM manipulation.
  • Can be coded in most web programming languages, for this illustrative post the script highlighted is written in PHP.

Start by creating a file with a .php at the end. Below is the code, I won’t go into the explanation of what it does, but mainly to get information from the meta tags of a web page.

#!/usr/bin/php
<?php

function getMetaData($url){
// get meta tags
$meta=get_meta_tags($url);
// store page
$page=file_get_contents($url);
// find where the title CONTENT begins
$titleStart=strpos($page,'<title>’)+7;
// find how long the title is
$titleLength=strpos($page,'</title>’)-$titleStart;
// extract title from $page
$meta[‘title’]=substr($page,$titleStart,$titleLength);
// return array of data
return $meta;
}

$tags=getMetaData(‘http://www.yoursite.com&#8217;);

echo ‘Title: ‘.$tags[‘title’];
echo “\n”;
echo ‘Description: ‘.$tags[‘description’];
echo “\n”;
echo ‘Keywords: ‘.$tags[‘keywords’];

?>

Next open up your terminal and navigate to where you have this file located. In the file be sure to identify the domain that you’re looking up. From the terminal you type in php nameofyourscript.php and press enter.  After a few seconds you would see the meta tags information of the domain. View the video below to get an idea.

So Whats the Big Fuss?

Well as I said earlier, this is a quick way to look up a domain info for SEO without opening up your web browser. Now you can build this out to look up:

  • Other meta info
  • multiple url’s lookup
  • check page load speed
  • scrape SERP listing of Google and Bing
  • get locations of nearest pizza joint
  • get twitter followers count
  • scrape SocialMention results
  • collect the links onpage and store to a database for further processing

As you can see what you do with the script is endless. Another note there are many different ways to write the previous script. I am not the most eloquent coder, just a newbie coder to manipulate things. Please feel free to comment and share with us on what you’ve created to help with your SEO process.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s