PHP Classes

File: getProxiesExample.php

Recommend this page to a friend!
  Classes of Marcelo Octane FX   ObjectVar   getProxiesExample.php   Download  
File: getProxiesExample.php
Role: Example script
Content type: text/plain
Description: Get a list of proxies from www.proxz.com using class.ObjectVar and class.XMLHttpRequest
Class: ObjectVar
Create and assign dinamic variables
Author: By
Last change: added link to class.XMLHttpRequest.php from Moises Lima
Date: 14 years ago
Size: 1,573 bytes
 

Contents

Class file image Download
<?php
require("class.objectvar.php");
require(
"class.XMLHttpRequest.php");
//get here http://www.moonlight21.com/class-XMLHttpRequest-php
function check($method,$url,$vars=null){
   
$ajax=new XMLHttpRequest();
   
$ajax->open($method,$url,true);
   
$ajax->send($vars);
   
$response["text"]=$ajax->responseText;
   
$response["status"]=$ajax->status;
   
$response["allHeaders"]=$ajax->getAllResponseHeaders();
    return
$response;
}
echo
"<pre>";
for(
$o=1; $o<=2;$o++){
   
$url = 'http://www.proxz.com/proxy_list_high_anonymous_' . $o . '.html';

    ${
"result$o"} = check("GET",$url);
    ${
"pagina$o"} = new ObjectVar;
    ${
"pagina$o"}->create("url",$url);
   
   
//if(${"result$o"}['text']) ${"pagina$o"}->create("text",(${"result$o"}['text'])?${"result$o"}['text']:false);
   
if(${"result$o"}['status']) ${"pagina$o"}->create("status",(${"result$o"}['status'])?${"result$o"}['status']:false);
    if(${
"result$o"}['allHeaders']) ${"pagina$o"}->create("allHeaders",(${"result$o"}['allHeaders'])?${"result$o"}['allHeaders']:false);
   
    if(${
"result$o"}['text']){
       
preg_match_all("/eval\(unescape\(\'(.*)\'\)\);/sim",${"result$o"}['text'],$tmp);
       
preg_match_all( '/<td>(\d+\.\d+\.\d+\.\d+)<\/td><td>(\d+)<\/td>/sim',urldecode($tmp[1][0]), $the_proxies );
        for(
$i=0; $i<count($the_proxies[1])-1; $i++ ){
           
$all_proxies[] = $the_proxies[1][$i].":".$the_proxies[2][$i];
        }
        ${
"pagina$o"}->create("proxies",$all_proxies);
        unset(
$all_proxies);
        unset(${
"result$o"});
    }
}
for(
$p=1;$p<=ObjectVar::getNumInstances();$p++){
print_r(${"pagina$p"});
}
echo
"</pre>";
?>