PHP Classes

ObjectVar: Create and assign dinamic variables

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 326 All time: 7,186 This week: 206Up
Version License PHP version Categories
object-var 0.1GNU General Publi...5.3PHP 5, Data types
Description 

Author

This class can create any type of variables or objects dynamically.

It can create and assign object variables with names defined dynamically.

The class can also be used as service container too.

Picture of Marcelo Octane FX
Name: Marcelo Octane FX <contact>
Classes: 1 package by
Country: Brazil Brazil

Example

<?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>";
?>


  Files folder image Files (3)  
File Role Description
Plain text file class.objectvar.php Class Create and assign dinamic vars
Accessible without login Plain text file getProxiesExample.php Example Get a list of proxies from www.proxz.com using class.ObjectVar and class.XMLHttpRequest
Accessible without login Plain text file index.php Example how to use :B

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:326
This week:0
All time:7,186
This week:206Up