I have a scraping object basically. I want to be able to add POST variables to it like
$obj->addvar('Name', 'Value');
What I have now is this:
function addvar($var, $val) {
$postvars[] = Array($var=>$val);
}
function initiate() {
$this->q = $postvars;
}
if(!empty($this->post)) {
$this->params = http_build_query($q);
}
I haven't tested because it's too incomplete, But would my addvar() function work? How on earth do I append a key+value to the array so http_build_query would accept it?
IE (this is what I want):
$obj->addvar('username', 'abc');
$obj->addvar('password', 'foobar');
$obj->send(); //..