Webmaster's Community

Designing and Development => Programming => Topic started by: omi on July 16, 2011, 01:51:36 PM

Title: Catchable fatal error: Object of class Net_Ping_Result could not be converted to
Post by: omi on July 16, 2011, 01:51:36 PM
I am trying to ping domains / ips through php and I am using pear. I am using NET/Ping pear class. Now when I try to execute following code..

Code: [Select]
require_once "Net/Ping.php";
    $ping = Net_Ping::factory();
    if(PEAR::isError($ping)) {
      $name = $ping->getMessage();
}
    else
    {
      /* Number of packets to send */
      $ping->setArgs(array('count' => 4));
        $rawData=$ping->ping('18.23.32.2');
      $name = "<pre>" . $rawData . "</pre>";
}

I want to then later give outfrom $name as array but I am facing the error ..
Code: [Select]
Catchable fatal error: Object of class Net_Ping_Result could not be converted to