destroy_cookies(); $login_page = $curl->get($this->domain."/202-login.php"); //var_dump($login_page); $regex = '//'; preg_match_all($regex, $login_page, $matches); //var_dump($matches); $this->token = $matches[1][0]; } function p202_login($username, $password) { $curl = new Curl(); $this->get_token_var(); $submit_url = $this->domain."/202-login.php"; $referer = $this->domain."/202-login.php"; $post_vars['token'] = urlencode($this->token); $post_vars['user_name'] = urlencode($username); $post_vars['user_pass'] = urlencode($password); $post_string = $this->make_post_string($post_vars); if ($post = $curl->postForm($submit_url, $post_string, $referer)) { //var_dump($post); //uncomment above line to troubleshoot....login most likely successful :-D } } function my_implode($array) { // sanity check if (!$array || !count ($array)) return ''; // get last element $last = array_pop ($array); // if it was the only element - return it if (!count ($array)) return $last; return $this->my_implode($array)."\r\n".$last; } function update_converted_subids($array) { //updates converted subids. $curl = new Curl(); $submit_url = $this->domain."/tracking202/update/subids.php"; $referer = $this->domain."/tracking202/update/subids.php"; // $post_string = "subids=".implode("\r\n", $array); $post_string = $this->my_implode($array); $post_string = "subids=" . $post_string; //print urlencode($post_string); //%0A%0D is a linefeed...aka \r\n (newline, carriage return) if ($post = $curl->postForm($submit_url, $post_string, $referer)) { //var_dump($post); //uncomment above line to troubleshoot....update most likely successful :-D echo "\nUpdate Of Subid's Successful :-)\n\n"; } } function make_post_string($array) { //takes assoc array and makes it into a post string :-) foreach($array as $f => $v) $array .= $f . '=' . $v . '&'; $array = rtrim($array, '&'); $array = str_ireplace("array", "", $array); $post_string = $array; return $post_string; } function prosper202($domain) { //This function is executed on class initiation - $domain should be http://example.com - NO ENDING SLASH if (!stristr($domain, "http://")) { $domain = "http://".$domain; } $this->domain = $domain; } } ?>