fetchresult = FALSE; $request = Request::factory($this->aso->stats_url) ->method('POST') ->post($this->login_user_field,$this->aso->stats_username) ->post($this->login_pass_field,$this->aso->stats_password) ->post($this->date_field,$date); $request->client()->options($this->curlopts+array( CURLOPT_POST => TRUE, )); $response = $request->execute(); $data = $response->body(); $resultarray = explode("\n",$data); // The first field should be a header, so we can ignore it: if (preg_match('/^Login/',$resultarray[0])) { array_shift($resultarray); $this->fetchresult = TRUE; } // If we got the expected data, we can parse it. if ($this->fetchresult) foreach ($resultarray as $details) { if (! trim($details)) continue; $valuesarray = explode(',',$details); // Extel VISP stores data in MB's*100. $attrs = array(); $attrs['service'] = $valuesarray[0]; $attrs['date'] = $valuesarray[1]; $attrs['up_peak'] = $valuesarray[2]/100; $attrs['down_peak'] = $valuesarray[3]/100; $attrs['up_offpeak'] = $valuesarray[4]/100; $attrs['down_offpeak'] = $valuesarray[5]/100; array_push($result,$attrs); } return $result; } } ?>