Friday, November 11, 2011 and Your Email Address

Spoiler/summary: don't use the same email address for Craigslist as Facebook.

Recently a friend of mine ran into one of those random crazy people that seem to exist on the internet for the sole reason to make it worse. My pal posted a Craigslist classified ad for some collectable items and received a response shortly after by someone claiming to be interested. Everyone who's posted on Craigslist is used to the classic scammers, however stalkers and creeps are normally safely kept over at the shady dating section that you don't go to... he didn't expect what he got.

On the internet, you're best defense is anonymity to the public. Here are a few common tips:
  • Don't make your profile information public (Facebook, MySpace, etc)
  • Don't post your where-abouts
  • Don't post your phone number or email address
  • Its even been recommended that you don't share photos of yourself
Some of those recommendations are based on the paranoia instilled by the News talking about women being kidnapped because they share there entire lives on the internet. Frankly, due to the small amount of times that happens, I think Facebook is safer than going to public events or the grocery store even. The  only tip above that I follow is not posting my phone number, but I'm in the web/social industry and am kind of expected to participate. Share at your own comfort, but I'd recommend not sharing exact location and phone number.

Going back to the story of my friend, he like most people who use Craigslist used Craigslist's random email address feature (the one that looks like That's great and all, keeps people from collecting your email address for spam easily, but it only one way and only for the first email. When you reply to someone's email to you at that email address, it responds using your normal address and now that person you don't know has your email. He responded and next thing he knew, they guy turns out to be a freak. Worst of all, he has his email address which is the same one my friend uses for Facebook which just supplied the weirdo with his personal info.

Long story short, if you want to keep that distance between you and your internet (and all the creeps that come with it), keep in mind who gets your email address because it could make it very easy for them to get your other information.

Tuesday, October 18, 2011

Wordpress: You do not have sufficient permissions to access this page.

I ran around in circles last night trying to figure out the culprit to this Wordpress error
You do not have sufficient permissions to access this page.
I finally ran into this blog this morning... saving my day (more or less literally).

Wednesday, April 20, 2011


Cutting to the Chase

So I've noticed there isn't much for documentation on the use of CURLOPT_HEADERFUNCTION so I've decided to try explaining it. So lets start with an example.


class cURL {
    public $response;
    public $header;
    function cURL($url){
        $ch = curl_init($url);
        curl_setopt_array($ch, array(
            CURLOPT_RETURNTRANSFER => true, //Causes curl_exec() to return the response
            CURLOPT_HEADER         => false, //Suppress headers from returning in curl_exec()
            CURLOPT_HEADERFUNCTION => array($this, 'header_callback'),
        $this->response = curl_exec($ch);
        return $this->response;

    function header_callback($ch, $header_line){
        $this->header .= $header_line;
        return strlen($header_line);

This is a really simple example of the use of curl. Really a solid class would have a whole lot more going on, but that isn't what this example is for...

CURLOPT_HEADERFUNCTION expects the name of the function to callback when it receives the headers from the request. There are two common ways you'll see this:

  • CURLOPT_HEADERFUNCTION => 'header_callback',

  • CURLOPT_HEADERFUNCTION => array($this, 'header_callback'),

If you are familiar with call_user_func_array() you're a step ahead and can skip to the next section.
For a normal function, simply the name of the function will suffice, but to call a method you'll need to pass an array with the object and the method to call on it.
In my example, I'm calling $this->header_callback() by using array($this, 'header_callback').

The Callback Function/Method


You'll need to define the function or method you'll want to use as the callback.
There isn't a whole lot of variation between working example's I've found, that is probably because there isn't a whole lot you can do.

Parameter 1: The curl object created by curl_init. This is handy for some rare scenarios, but for the most part useless.

Parameter 2: A single line from the header. This is where some people get lost, its the GOTCHA and I'll explain it below.

Returns: The function/method MUST return the number of bytes written. Why? I'm really not sure, but it must be done or it throws errors at you till you die.


Something not clearly stated anywhere is that the header doesn't come all in one chunk, in my experience the callback is executed for each line of the header.
This makes using CURLOPT_HEADERFUNCTION outside of an object cumbersome because you'll likely end up using a global variable (which is just ugly and some old guys will call you the devil).
For OOP'ers, you'll have no problem just appending the lines to a property like in my example where I use $this->header.

Comment, Tweet, Like, Share, or whatever is hip with the kids these days

If you found this useful and better than other tutorials for CURLOPT_HEADERFUNCTION, please show me some love on the great interwebs.

Saturday, January 8, 2011

New Website is a small, quick one page business site. From first contact on Wednesday to publication tonight, the project went smoothly without a hook.

*Revised: Never say "without a hook". Client decided she wanted more for free and then demanded a refund because she didn't get new clients (within first month of new site). Fun fun