$body, 'data_format' => 'body', 'headers' => $headers, 'method' => $method ) ); return json_decode($result['body']); } function escapeJavaScriptText($string) { return str_replace("\n", '\n', str_replace('"', '\"', addcslashes(str_replace("\r", '', (string)$string), "\0..\37'\\"))); } function astrk_get_login_token($username, $password) { $auth = array( "username" => $username, "password" => $password ); $r = astrk_json_remote_post("https://api.adservice.com/v2/client/account/logintoken", null, $auth); if(isset($r->data)) { return array($r->data->uid, $r->data->login_token); } } function astrk_check_login($options) { $r = astrk_json_remote_get("https://api.adservice.com/v2/client/account/", $options); if (isset($r->success) && $r->success) { return $r; } else { return false; } } function astrk_get_campaigns($options) { $r = astrk_json_remote_get("https://api.adservice.com/v2/client/campaigns/?get_prices=1", $options); $campaigns = array(); if (isset($r->success) && $r->success) { return $r; } } ?>