Reply about the Scraping Example Test code.

This post is a reply to the shinokada's question.

Creating an object from a class in Codeigniter -

CodeIgniter study 14 (In Japanese text) -

In English text (Google Translator) -

I've tried to post again. but I couldn't post with hyperlinks. sorry.. I'll answer to that in this site.(I'm a newbie :-( )

I think that I'll try to repost these answers after a few days .(on


Hi! . This sample Scraping code was written based on using the library:
Snoopy - the PHP net client ( )

Mistakes in my English ,please pardon me : )

Q1. Am I correct to say that I can't use,


You have to install this source code:

  • step1: Download the base source( at
  • step2: Unzip Snoopy-1.2.4
  • step3: Rename Snoopy.class.php to Snoopy.php (My sample Scraping libraly name is not 'Snoopy.php', 'Scraping.php' is correct)
  • step4: Move Snoopy.php(which was renamed) to application/libraries/Snoopy.php
  • step5: Install my sample wrapper code(class Scraping) to application/libraries/Scraping.php

Required php-curl environment, I dont know how to install it on XAMPP.
This site may help you - ,
Under the Linux OS, it's easy to install . (ex. yum install curl or apt-get install curl)

If you want to try to use 'Snoopy class' only in HTTP ,Change the Snoopy.php at line 85. so Note1 is not required.

Snoopy.php (which was renamed) at line 85:

 #var $curl_path="/usr/local/bin/curl";
 var $curl_path=false;

Q2. Why do the author use


That's an "auto HtmlSpecialchars option".
Because the browser does not display the HTML tags.

(please see: ).

In the sample wrapper code, I use 'mb_convert_encoding' functions.
This php-function may not be installed on English environment.
(see: )

If you can't use this 'mb_ php-function' Change this. ..(or Install 'mb_' functions):

Scraping.php(my Snoopy Wrapper example code):

 #$str = mb_convert_encoding( (string) $this -> c -> results,"UTF-8","auto");
 $str = (string) $this -> c -> results ;

Q3. Could you explain APPPATH and EXT.


'APPPATH' and 'EXT' are Reserved Names(Constants) on CodeIgniter.

'APPPATH' - The full server path to the "system" folder. (ex. '/var/blah/blah/system/application/')

'EXT' - The file extension. Typically '.php'

(see:htdocs/index.php at line 88)
(see also:

Regards. :-)