Results 1 to 10 of 10
Hybrid View
-
19th Jul 2010, 01:16 PM #1OPMemberWebsite's:
litewarez.net litewarez.com triniwarez.comOk some of you have asked for an example for a template engine, well ive already done that.
http://www.besthostingforums.com/showthread.php?t=38800
AS for the example of curl here is a little one:
PHP Code:Class MyCurl
{
private $handler = null; //Used to hold the reource from curl_init();
private $url = null; //Hold the url were fetfching
private $options = array();
private $data = '';
public function __construct($url = false) //used when you create the object like $var = new Curl
{
$this->seturl($url);
}
public function SetUrl($url)
{
$this->url = $url;
}
public function SetOpt($name,$value)
{
if(is_array($name))
{
foreach($name as $key => $value)
{
$this->SetOpt($name,$value);
}
return;
}
$this->options[$name] = $key;
}
public function Init()
{
$this->handler = curl_init($this->url);
curl_setopt_array($this->handler ,$this->options);
$this->data = curl_exec($this->handler);
}
public function GetData()
{
return $this->data;
}
//Here just create your own methods such as
}
$MyCurl = new MyCurl('google.com');
$myCurl->SetOpt(CURLOPT_PORT,80);
$MyCurl->Init(); //Send the request
$data = $MyCurl->GetData();
AS for the reusable code section in my First Post, all you have to do is add a function to set all the variables within the class back to there originals, you can then just use SetUrl to start a new request. and so on.litewarez Reviewed by litewarez on . [PHP] Discussion (System Building) This thread is mainly to try and help guide the lost sheep in the right direction when it comes to PHP and building systems securely. Now you all probably think that I'm real good at PHP but I'm not, what im good at is understanding architecture. What i mean by architecture is summarized in these key points Functional/logic view Code/module view Development/structural view Rating: 5Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
PHP PDO login system, user class. Also Includes a theming system {Source}
By xifyhosting in forum Web Development AreaReplies: 3Last Post: 29th Aug 2012, 02:33 AM -
Free Report : List Building System
By errabbaa in forum Webmasters, Money MakingReplies: 2Last Post: 6th Jun 2012, 01:25 PM -
The FartMan is in the building...
By The FartMan in forum IntroductionsReplies: 3Last Post: 25th Jun 2011, 04:04 PM -
Building R/C Car
By sniper in forum General DiscussionReplies: 6Last Post: 11th Jul 2010, 09:19 PM -
building your pr-
By clarksta in forum Webmaster DiscussionReplies: 5Last Post: 17th Nov 2008, 04:11 PM
themaCreator - create posts from...
Version 3.53 released. Open older version (or...