Home
Home Page
In detail about Robots.txt
Safe programming on PHP
We write elementary rassylhhik
Use of HTML-tables for a conclusion of diagrams
What is dorvei? Whether Banjat for them?
How to learn{find out} on what searches find my site in search machines?
Cunnings of tabulared design. (we form a framework of the table)
The guest book on PHP
BB-codes
We hide counters
Use of patterns of design in ASP.NET
RSS the generator
Search optimization of a site
Metatags
Optimization for MSN
We
Cookies - fresh rolls
Superdynamical webs - interfaces
Links
 

We "Plunder" pages

With audiograbberami all are familiar. We should make own grabber information of the Internet. We need the guinea pig for which role I suggest to choose a site http://subscribe.ru:-) That we can pull together at them good? As a matter of fact, there good it is a lot of, but there is something, that to us and our visitors can really be useful! I have the list of the new dispatches translated in a category silver in a kind. Not a secret, that when translate dispatch in this category, its{her} rating (as quantity{amount} of subscribers) by all means flies up. It is free or involuntarily we shall promote this process as visitors of your site can subscribe for the dispatches which have liked them directly, so to say, not departing from cash department. For the beginning we will need the address, whence we shall plunder the information. He such - http://win.subscribe.ru/catalog/latest If will not arrange someone the coding, substitute the. To the specified address we find all translated in a category silver dispatches. And the list is constantly updated, remaining thus actual always.


I bring all code, explanatories to it  - are farther...



<?

// The beginning

$link = " http: // win.subscribe.ru/catalog/latest ";

$file = @fopen ($link, "r");

if ($file) {$rf = fread ($file, 200000); fclose ($file);} else {echo " Excuse, the requested page temporarily is not accessible! ";}


// 1

$rf = trim (chop ($rf));

$s = strpos ($rf, " $rf = substr ($rf, $s);


// 2

$s = strpos ($rf, " $rf = substr ($rf, 0, $s);


// 3

$rf = str_replace ("/catalog / ", " http: // win.subscribe.ru/catalog / ", $rf);

$rf = str_replace ("/archive / ", " http: // win.subscribe.ru/archive / ", $rf);

$rf = str_replace (" ACTION =/member/quick ", " ACTION=http: // win.subscribe.ru/member/quick ", $rf);

$rf = str_replace ("/img/money2.gif", " http: // win.subscribe.ru/money2.gif ", $rf);

$rf = str_replace ("/img/a114.gif", " http: // win.subscribe.ru/af.gif ", $rf);

$rf = str_replace ("/img/af.gif", " http: // win.subscribe.ru/af.gif ", $rf);


// 4

echo $rf;

?>


And now have gone! Right at the beginning we need to extort a page. We write down its{her} address and it is opened on it  connection. Further there is a check - if connection successfully, it is possible to count all file (not philosophizing it is crafty specified 200000 bytes for reading, that is obvious more size of an opened file) if there was a mistake of opening, we warn about it the visitor and everything is deduced{removed} to him, for example a banner.


Stage 1.

$rf = trim (chop ($rf)); - this odd combination we shall considerably reduce volume of the processable data as we shall clean{remove} repeating blanks and blanks in the end and in the beginning of a file. Then we need to be defined{determined} with a place, whence we shall deduce{remove} the information. The analysis of a code gives us very effective mechanism, and we shall by all means use him .

$s = strpos ($rf, " - this command allows to find number{room} of a position of the specified sequence of symbols in line where we counted all code of a file. The result is located in a variable $s

$rf = substr ($rf, $s); - it is severe obrezaem everything, that is before this combination. Including banners, by the way.


EHtap2.

We do{make} almost too most, but only for the end of a file. The file appears is cut off from the beginning and from the end how we would like that. I pay your attention, that in this case all appeared very simply, but sometimes it is necessary to apply others of a method to a cutting of a code as there are no so precise borders. But almost always it is possible to think up something. As a result of this processing we already have almost everything, that is necessary. Basically it was possible to deduce{remove} simply all on the screen, but there is one nuance which needs to be taken into account. It - links. They not absolute, but relative. Well though, it is not enough of them... And in that case the problem is solved simply.


EHtap3.

We take, and it is replaced that there is that is necessary for us. For example:

$rf = str_replace ("/catalog / ", " http: // win.subscribe.ru/catalog / ", $rf);

This line of a code allows us to replace in all line $rf relative links on absolute. The same way we act with all other links which meet in a code of a page. Roughly, but is exact...


EHtap4.

Here we simply deduce{remove} result on the screen to the visitor. And this result - code HTML of a page necessary to us which will be displayed by a browser. If you want to integrate this code to yourselves, you most likely should make one more - to finish with tables which strive on width vylezt` from your design. But here think. Anything complex  no - finds, that is responsible for the size of page, and we replace it with an empty line.


Result - on the screen. If want to see as all this works in a nature, visit page http://virtual.bresttelecom.by/komputer/ There there is this example and as others two, but I suggest to see at them. For today all.


There come many questions on a subject of installation and adjustment RNR and Apache. To tell the truth, I in this business not so well understand (in installation under Win), but can advise to address to whom. http://www.design-studios.ru/php/apache/ This site and his  author, I hope, can help you with hard business of adjustment. There the best and detailed descriptions are laid out, it is a lot of helpful information on a subject. Use...