■[CodeIgniter][PHP] 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 stackoverflow.com :-( )
I think that I'll try to repost these answers after a few days .(on stackoverflow.com)
Hi! . This sample Scraping code was written based on using the library:
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(Snoopy-1.2.4.zip) at http://sourceforge.net/projects/snoopy/
- 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
This site may help you - http://stackoverflow.com/questions/176449/how-to-install-php-curl/ ,
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: http://www.php.net/manual/en/function.htmlspecialchars.php ).
In the sample wrapper code, I use 'mb_convert_encoding' functions.
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)