[eluser]Unknown[/eluser]
Hi guys, i am building an application that will traceroute a host and display the data on googlemap. I am currently using pear's traceroute library. Able to run the traceroute() command but it seems to throw me one error.
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 5
Filename: Net/Traceroute.php
Line Number: 531
Traceroute.php is the library class i called. It seems like it has a problem with the array associated to line 531. I can't seem to find the problem.
Below is the code of the library class
Code:
function _parseResultwindows()
{
$raw_data_len = count($this->_raw_data);
$dataRow = 0;
while (empty($this->_raw_data[$dataRow]) && ($dataRow<$raw_data_len)) {
$dataRow++;
}
$tempparts = explode(' ', $this->_raw_data[$dataRow]);
$searchIdx = 0;
while (($searchIdx < count($tempparts)) && (substr($tempparts[$searchIdx], 0, 1) != '[')) {
$searchIdx++;
}
$this->_target_ip = trim($tempparts[$searchIdx], ' [],');
while (($searchIdx < count($tempparts)) && ((int) $tempparts[$searchIdx] <= 0)) {
$searchIdx++;
}
if ((int) $tempparts[$searchIdx] > 0) {
Quote:This is Line 531------^ "if ((int) $tempparts[$searchIdx] > 0) {"
Code:
$this->_ttl = (int) $tempparts[$searchIdx]; // TTL might be written in next line; e.g. on Windows 98
} elseif (!empty($this->_raw_data[$dataRow+1])) {
$dataRow++;
$tempparts = explode(' ', $this->_raw_data[$dataRow]);
$searchIdx = 0;
while (($searchIdx < count($tempparts)) && ((int) $tempparts[$searchIdx] <= 0)) {
$searchIdx++;
}
In my controller, this is how i call the traceroute() function:
Code:
$host = $this->input->post('ip_text');
$this->load->library('pearloader');
$tr=$this->pearloader->load('Net_Traceroute',"", "WANXING");
$tr = Net_Traceroute::factory();
if(!PEAR::isError($tr)) {
// trace route to host and get response
$response = $tr->traceroute($host);
// print response
echo $response->getRawData();
}
Everything is displaying correctly just that the error keep popping out. Any help will be deeply appreciated. I am using the lastest release of Traceroute package from PEAR--> version 0.21.3