@Rob Bertholfhttp://rob.bertholf.com
Search Engine Optimization ExpertSun, 22 Mar 2015 17:29:15 +0000en-UShourly1Easily check if a site is linking to youhttp://rob.bertholf.com/php/check-if-site-linking-to-you/
http://rob.bertholf.com/php/check-if-site-linking-to-you/#commentsThu, 26 Feb 2015 22:26:43 +0000http://rob.bertholf.com/?p=2696If you find a situation where you need to identify if a site links to you. For the purpose of this exercise we will be referencing the homepage but we can expand the article later to discuss how to crawl a site where the basic principles are the same but replicated for each URL in [...]

]]>If you find a situation where you need to identify if a site links to you. For the purpose of this exercise we will be referencing the homepage but we can expand the article later to discuss how to crawl a site where the basic principles are the same but replicated for each URL in the site… ok, let’s get started.

Remotely Scrape HTML File

The first step is to remotely grab the HTML source of a website. There are two main ways to achieve this cURL and file_get_contents().

file_get_contents()

The most simple and most widely used method of obtaining the contents of a file is file_get_contents(). While this works great locally, to remotely fetch a file’s contents you will need to check that allow_url_fopen is enabled (which may present security risks). To implement you would use the following line:

This will return the site’s HTML. To prevent it from rendering so you can read it easier consider converting the content type to plain/text by adding the following line at the top of your document:

header('Content-Type: text/plain');

Is the site linking to you?

Now that we have the HTML we can search it to identify if a URL is present. This can be done fairly easily using Regular Expression. We will use a few functions for this, preg_quote (escape special characters), some light regex and preg_match_all (to check if the link is in the HTML we returned.

]]>http://rob.bertholf.com/php/check-if-site-linking-to-you/feed/0Torrey Pines State Natural Reservehttp://rob.bertholf.com/photography/torrey-pines-state-natural-reserve/
http://rob.bertholf.com/photography/torrey-pines-state-natural-reserve/#commentsTue, 27 Jan 2015 00:19:52 +0000http://rob.bertholf.com/?p=2642Torrey Pines State Natural Reserve is located within San Diego city limits and yet remains one of the wildest stretches of land on our Southern California coast! Because of the efforts and foresight of the people in this area, 2000 acres of land are as they were before San Diego was developed -with the chaparral [...]

]]>Torrey Pines State Natural Reserve is located within San Diego city limits and yet remains one of the wildest stretches of land on our Southern California coast! Because of the efforts and foresight of the people in this area, 2000 acres of land are as they were before San Diego was developed -with the chaparral plant community, the rare and elegant Torrey pine trees, miles of unspoiled beaches, and a lagoon that is vital to migrating seabirds.

]]>http://rob.bertholf.com/photography/favorite-flavor/feed/0Makapu’u Point Lighthouse Trailhttp://rob.bertholf.com/photography/makapuu-point-lighthouse-trail/
http://rob.bertholf.com/photography/makapuu-point-lighthouse-trail/#commentsThu, 25 Dec 2014 21:53:05 +0000http://rob.bertholf.com/?p=2418Makapu’u Point Trail on the Kaiwi State Scenic Shoreline More Creative Commons photos available for use on my Flickr page.

]]>http://rob.bertholf.com/photography/oahu-helicopter-tour/feed/0Do the Dewhttp://rob.bertholf.com/photography/honeydew-melon/
http://rob.bertholf.com/photography/honeydew-melon/#commentsSun, 25 May 2014 21:25:26 +0000http://rob.bertholf.com/?p=2382Honeydew Melon More Creative Commons photos available for use on my Flickr page.

]]>http://rob.bertholf.com/photography/lemon-lemonade/feed/0Torchy’s Tacos Austin Texashttp://rob.bertholf.com/photography/torchys-tacos-austin-texas/
http://rob.bertholf.com/photography/torchys-tacos-austin-texas/#commentsSat, 15 Mar 2014 21:23:47 +0000http://rob.bertholf.com/?p=2332Not sure there is anything more delicious in the world than Torchy’s Tacos in Austin, Texas. Each year I go to SXSW this is my first bite! More Creative Commons photos available for use on my Flickr page.

]]>http://rob.bertholf.com/photography/torchys-tacos-austin-texas/feed/0South by South West SXSW 2014http://rob.bertholf.com/photography/south-south-west-sxsw-2014/
http://rob.bertholf.com/photography/south-south-west-sxsw-2014/#commentsTue, 11 Mar 2014 20:48:43 +0000http://rob.bertholf.com/?p=2296Austin Texas for South by South West (SXSW) 2014 More Creative Commons photos available for use on my Flickr page.