Edmonds Commerce Logo
  • home
    • blog
  • ecommerce
    • product catalogue
    • order processing
    • customer services
    • stock control
    • human resources
    • management information
  • development
    • oscommerce
    • php
    • mysql
    • open source
    • performance tuning
  • design
  • marketing
  • contact us
    • pricing

Edmonds Commerce Blog

Freelance PHP Ecommerce and SEO Developer in the UK

Latest Posts

CRELoaded Remove Google Ads -
ICECat Integration with osCommerce, Magento etc
Magento UK
PHP Cached Download Function

Most Popular Posts

PHP Email Attachment Function Freelance osCommerce UK Ultimate osCommerce Checkout - Fast and Friendly PHP : Dead Easy Excel Export

Archive for the 'firefox' Category

Favourite Firefox Extensions

Tuesday, February 26th, 2008

Firefox is awesome. The thing that really makes it awesome is the fact that it is very easy to customize it to have all the functionality you could dream of. The way that firefox does this is by allowing you to install add-ons. These little additions to the program bring extra functionality to firefox.

Here’s a list of my current favourites in no particular order:

SEO for Firefox

ColorZilla

Web Developer Toolbar

Live HTTP Headers

Google Toolbar

Ad Block Plus

Prefbar

Plain Text to Link

Here are some Other Favourite Firefox Addon Blogs
http://booststrapping.typepad.com/booststrapping/2007/05/top_firefox_add.html
http://www.noinham.info/e-commerce/nhung-firefox-plug-in-huu-ich-cho-web-design/
http://chris.pirillo.com/2008/01/08/favorite-firefox-extensions/
http://mouseblog.wordpress.com/2008/01/23/extend-your-firefox/
http://blogs.lib.umanitoba.ca/carol/2007/04/my_favourite_addons_for_firefo.html
http://www.technologyevangelist.com/2006/11/googlepedia_my_favor.html
http://gratemedia.com/fluentinmumble/2007/11/15/favorite-firefox-extensions/
http://mp.blogs.com/mp/2005/05/on_my_favorite_.html
http://librarianinblack.typepad.com/librarianinblack/2008/02/sarahs-top-ten.html
http://flyinghamster.com/blog/2006/10/31/favorite-firefox-extension/

Posted in firefox | No Comments »

Essential Search Engine Optimisation Research Tool

Saturday, February 16th, 2008

A large part of an effective SEO campaign involves researching the current top ranking sites for your chosen key words or phrases and then trying to figure out what they are doing to get there. This can be a painstaking and laborious task. However there is one great tool which is highly recommended to give you a quick insight into the SEO factors contributing to a particular web sites ranking.

SEO for Firefox is an addon for firefox which does a few things. Firstly it can give you information displayed directly onto the search engine results pages. However this can seriously slow down your browsing experience depending on how many bits of SEO info you want to be displayed automatically, how many results you view in one page and of course how fast your internet connection and PC are.

Another neat feature of the SEO for firefox plugin is that it highlights any nofollow links on whichever page you are looking at in red. This is a useful feature which means you don’t have to read through source code to check for the nofollow attribute.

The final great feature is built into the right click menu. This allows you to open up a full report of whichever page you are looking at in a new window. I find this feature the most useful on a day to day basis as it is non invasive, but allows you to easily get the information you want on demand.

Definitely worth installing and playing around with, though by no means a substitute for proper investigation, the SEO for Firefox addon is a must for any web master or online marketing professional.

Posted in firefox, search engine optimisation | No Comments »

Building Spiders: Grab Data, Post Forms and Interact with Web Sites Automatically

Thursday, February 14th, 2008

One of the most useful and powerful things you can do with PHP is to create a programme which will simulate a web browser and can grab data, post data to forms and generally interact with other web sites - automatically.

For PHP to be able to work like this it must have the CURL library installed and active. It is the CURL library which actually handles all of the interaction and PHP is my scripting language of choice for interacting with CURL.

A simple CURL function is like this:

PLAIN TEXT
PHP:
  1. function curl($url){
  2.  
  3. $timeout = '300'; //how long before CURL gives up on this page
  4. $go = curl_init();
  5. curl_setopt ($go, CURLOPT_URL, $url);
  6. curl_setopt ($go, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt ($go, CURLOPT_FOLLOWLOCATION, 1);
  8. curl_setopt ($go, CURLOPT_TIMEOUT, $timeout);
  9. $spage = curl_exec($go);
  10. curl_close($go);
  11. return $page;
  12.  
  13. }

This function when called and echoed will output the entire html of the $url specified.

For grabbing data from this page to be inserted into a database (for example when spidering a suppliers web site for product information to be inserted into your site) we then use regular expressions to find what we are looking for and then insert that into the database.

so for example if we wanted to grab the product title and we knew that this was wrapped in a h1 tag with the class "product title" we could use this regexp to grab this:

PLAIN TEXT
PHP:
  1. $page = curl($url);
  2.  
  3. $pattern = '%
  4. <h1 class="product_title">(.+?)</h1>
  5. %i';
  6.  
  7. preg_match($pattern,$page,$matches);
  8.  
  9. print_r($matches); //we can see the entire array of matches and choose which we want to insert into the database

We can also Post data to web sites using curl. This allows us to do all kinds of things including grabbing data that is displayed on the submission of post forms. Here is an example Curl Post Function:

PLAIN TEXT
PHP:
  1. function curl_post($url,$post_data){
  2.  
  3. $timeout = '300'; //how long before CURL gives up on this page
  4. $go = curl_init();
  5. curl_setopt ($go, CURLOPT_URL, $url);
  6. curl_setopt ($go, CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt ($go, CURLOPT_FOLLOWLOCATION, 1);
  8. curl_setopt ($go, CURLOPT_TIMEOUT, $timeout);
  9. //now for the post section
  10. curl_setopt($go, CURLOPT_POST, true);
  11.  
  12. curl_setopt($go, CURLOPT_POSTFIELDS, $post);
  13. $spage = curl_exec($go);
  14. curl_close($go);
  15. return $page;
  16. }

It can be tricky to figure out exactly what data should be in the post string. To help you out though is this incredibly handy addon for firefox: Live Http Headers.

This addon lets you see exactly what is going on between your browser and the web site you are visiting. This can quickly and easily give you the information you need to replicate the same behaviour with your CURL script.

Edmonds Commerce specialise in working with PHP and CURL. If you have any spidering, screen scraping or other application that requires PHP to actively interact with other web sites - get in touch today to see how we can help you benefit from this incredibly powerful technique.

Related Resources

http://www.phpfour.com/blog/2008/01/20/php-http-class/

http://www.phpclasses.org/browse/package/1988.html

http://www.phpit.net/article/using-curl-php/

http://skeymedia.com/intro-to-curl-with-php/

Posted in curl, firefox, php, programming, spidering | No Comments »

  • RSS Feed
  • Categories

    • apache
    • barcode
    • creloaded
    • curl
    • customer services
    • debugging
    • ecommerce
    • email
    • excel
    • firefox
    • flash
    • gd
    • graphs
    • hosting
    • icecat
    • internet news
    • javascript
    • link building
    • linux
    • magento
    • management
    • mod_rewrite
    • mysql
    • oscommerce
    • php
    • plesk
    • product catalogue
    • product feed
    • programming
    • regular expressions
    • scraping
    • search engine optimisation
    • spidering
    • ubuntu
    • web design
    • web development
    • Windows
    • xampp
    • zip
  • Archives

    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
  • Tags

    addons advanced adverts blackhat blocking css curl development directories find firefox google hosts file html javascript keywords links msn mysql myths operators oscommerce paid links paid placement performance php ppc reciprocal linking replace screen scraping security seo serp speed spider spidering tuning user friendly vista web web design web developer
  • Random Posts

    • CRELoaded Remove Google Ads -
    • EAN13 Barcode Check Digit with PHP
    • PHP: Recursive Create Path (if not exists)
    • PHP MySQL Query Function with Easy Error Message
    • PHP Cached Download Function
    • osCommerce Contribution Released: Server Migration Synchronisation
    • Saving a File or Webpage using PHP
    • Handy Easy Javascript
    • PHP Email Attachment Function
    • PHP Random Sleep Function with Flush

Edmonds Commerce related questions? Send us a message or call us on 0844 357 0201.

Freelance PHP Web Design UK Commercial Web Design