WhoisParser icon indicating copy to clipboard operation
WhoisParser copied to clipboard

Fatal error: Class 'Novutec\WhoisParser\Result\AbstractResult' not found in D:\xampp\htdocs\WhoisParser\Result\Result.php on line 36

Open fritz4fun opened this issue 9 years ago • 18 comments

composer is installeld globally, symfony/yaml as well. Would appreciate if a senior coder jumps in and schools me on this one Thanks

fritz4fun avatar May 21 '15 13:05 fritz4fun

same here.

phrazer avatar Jun 15 '15 09:06 phrazer

same here..

hesyifei avatar Jul 12 '15 23:07 hesyifei

WhoisParser now seems to require composers autoloader. By using this with composer then it should work normally.

ghost avatar Jul 15 '15 09:07 ghost

@wearelogik and how to do that exactly?

hesyifei avatar Jul 15 '15 13:07 hesyifei

@eflyjason https://getcomposer.org

ghost avatar Jul 15 '15 13:07 ghost

@wearelogik I sudo composer install and add require 'vendor/autoload.php'; to Parser.php and it's now showing: Fatal error: Call to undefined method Novutec\DomainParser\Parser::setCustomDomainGroups() in WhoisParser/Parser.php on line 273

hesyifei avatar Jul 15 '15 13:07 hesyifei

Hello,

Don't include the autoloader inside Parser.php, remove your inclusion of Parser.php and include the autoloader instead.

ghost avatar Jul 15 '15 13:07 ghost

@wearelogik it's loading properly, but every domain just display Array ( [0] => % IANA WHOIS server % for more information on IANA, visit http://www.iana.org % % Error: Invalid query )...

Code:

require_once 'DomainParser/vendor/autoload.php';
require_once 'WhoisParser/vendor/autoload.php';

$Parser = new Novutec\WhoisParser\Parser();

$result = $Parser->lookup("arefly.com");

print_r($result->rawdata);

hesyifei avatar Jul 15 '15 13:07 hesyifei

@eflyjason

Try it without array but use json instead. I'm not exactly sure whats going on there, most likely due to your environment and setup and the information your giving doesnt tell me much.

https://whois.apitruck.com/hello.org This is a live current version of this script with composer using json.

ghost avatar Jul 15 '15 13:07 ghost

@wearelogik so you are sure the code is correct? I will try another environment then

hesyifei avatar Jul 15 '15 13:07 hesyifei

@eflyjason I don't have anything to do with this beside being a user just like you. All i'm saying is that i setup a working version when i used composer earlier today after i had struggled and given up for a while with the same problem.

ghost avatar Jul 15 '15 14:07 ghost

@wearelogik ok thank you very much :)

hesyifei avatar Jul 15 '15 14:07 hesyifei

Note that this error appears to occur any time the classes aren't autoloaded. Make sure the paths to the required classes are correct. In my case, path is case sensitive on Unix:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

//spl_autoload_extensions('.php'); // Only Autoload PHP Files

spl_autoload_register(function($className){
    //var_dump($className);
    //
    //Find the position of the first occurrence of a \ in $classname (All Namespaced Classes)
    if ( strpos($className,'\\') !== false )
    {
        // Reverse delimiter to convert to a path
        //$classFile = strtolower(str_replace('\\','/',$className));    // Fails on Unix
        $classFile = str_replace('\\','/',$className);

        if($className[0] !== '/'){
            $classFile = APPPATH.'third_party/'.$classFile.'.php';
        }
        //var_dump($classFile);
        if (file_exists($classFile)) require($classFile);
    }
});

diddykong avatar Jul 29 '15 01:07 diddykong

@diddykong how can I do that exactly?

hesyifei avatar Aug 10 '15 02:08 hesyifei

Above is autoloader.php. I have the following in the Constructor of my model that uses WhoisParser. require_once(dirname(__FILE__).'/../third_party/Novutec/autoloader.php'); require_once(dirname(__FILE__).'/../third_party/Novutec/DomainParser/Parser.php'); require_once(dirname(__FILE__).'/../third_party/Novutec/WhoisParser/Parser.php'); spl_autoload_register() takes the namespace, converts it to a path, and then autoloads the class.

diddykong avatar Aug 11 '15 09:08 diddykong

Remove this line: "require_once 'DomainParser/vendor/autoload.php';" and keep only "require_once 'WhoisParser/vendor/autoload.php';" in your script.

GeroldSetz avatar Mar 14 '16 22:03 GeroldSetz

how to run the parser so?

abra2015 avatar Jul 04 '16 09:07 abra2015

@abra2015 are you still having an issue? if so, please submit an issue at https://github.com/Whoisdoma/WhoisParser

xaoseric avatar Dec 28 '16 16:12 xaoseric