PHP Curl Digest


class curl
    var $channel ;

    function curl(  )
        $this->channel = curl_init( );
        // you might want the headers for http codes
        curl_setopt( $this->channel, CURLOPT_HEADER, true );
        // you may need to set the http useragent for curl to operate as
        curl_setopt( $this->channel, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        // you wanna follow stuff like meta and location headers
        curl_setopt( $this->channel, CURLOPT_FOLLOWLOCATION, true );
        // you want all the data back to test it for errors
        curl_setopt( $this->channel, CURLOPT_RETURNTRANSFER, true );
        // probably unecessary, but cookies may be needed to
        curl_setopt( $this->channel, CURLOPT_COOKIEJAR, 'cookie.txt');
        // as above
        curl_setopt( $this->channel, CURLOPT_COOKIEFILE, 'cookie.txt');    
    function makeRequest( $method, $url, $vars )
        // if the $vars are in an array then turn them into a usable string
        if( is_array( $vars ) ):
            $vars = implode( '&', $vars );

        // setup the url to post / get from / to
        curl_setopt( $this->channel, CURLOPT_URL, $url );
        // the actual post bit
        if ( strtolower( $method ) == 'post' ) :
            curl_setopt( $this->channel, CURLOPT_POST, true );
            curl_setopt( $this->channel, CURLOPT_POSTFIELDS, $vars );
        // return data
        return curl_exec( $this->channel );

$curl = new curl( );
// you should not execute both of these, but either way works
echo $curl->makeRequest( 'post', '', 'message=my message goes here' );
echo $curl->makeRequest( 'post', '', array('message=my message goes here', 'type=text') );

Cpanel API Digest

Hello every one! Let’s eat some tricks…


Cpanel Security token

“Security token” URLs were added in cPanel & WHM 11.25 as a security measure, and they were enabled by default in version 11.28. They help combat a common type of attack called a Cross-Site Request Forgery (XSRF).

So, what does a “security token” look like? Take, for example, this URL:

With security tokens enabled, this would become:

The token is available in the environment variable ‘cp_security_token’.

my $APIurl = "$ENV{'cp_security_token'}/xml-api/$url";

Find more information click here.





PHP Security Tools Digest

Here I’ll List good tools about PHP security…



PhpSecInfo provides an equivalent to the phpinfo() function that reports security information about the PHP environment, and offers suggestions for improvement. It is not a replacement for secure development techniques, and does not do any kind of code or app auditing, but can be a useful tool in a multilayered security approach.


PHP Websites

PHP Freaks is a website dedicated to learning and teaching PHP. Here you will find a forum consisting of 132,227 members who have posted a total of 1,379,780 posts on the forums. Additionally, we have tutorials covering various aspects of PHP and you will find news syndicated from other websites so you can stay up-to-date. Along with the tutorials, the developers on the forum will be able to help you with your scripts, or you may perhaps share your knowledge so others can learn from you.




Habits VS Contemplation

As I’m a digester! Let’s make it short. I’m thinking about this question which have come out from my big head!

And that is:

Are all of our good behaviors really GOOD?!!!

I mean: what’s the difference between good behaviors which comes from habits and good behaviors which comes from contemplation?

Think Think Think. We must contemplate about aour actions.

Hey Brother, All of our actions must be created on the contemplation and reasons.

Habits are unvalued but Good habits are really better than bad habits!