chobie / php-uv

libuv php extension
184 stars 21 forks source link

[ANN] cares removed. #23

Open chobie opened 11 years ago

chobie commented 11 years ago

https://github.com/joyent/libuv/issues/518

https://github.com/chobie/php-uv/tree/develop

TODO: take a look into PECL ares and write how to migrate bundled functions.

xming commented 11 years ago

Or maybe port this https://code.google.com/p/netdns2/source/browse/trunk/Net/DNS2.php to use php-uv?

igorw commented 11 years ago

@xming for userland DNS take a look at react/dns. We're in the process of integrating the libuv loop so that they can be composed.

I would really like to see an updated version of the ares pecl extension though. I couldn't get the current one to work properly.

xming commented 11 years ago

It works for me. I am using

How to:

<?php
$a = ares_init();
function cb()
{
        $argv = func_get_args();
        print_r($argv);
}
ares_gethostbyname($a, "cb", "google.com");
ares_gethostbyaddr($a, "cb", "8.8.8.8");

ares_process_all($a);
ares_destroy($a);

produces

Array
(
    [0] => Resource id #6
    [1] => 0
    [2] => stdClass Object
        (
            [name] => google-public-dns-a.google.com
            [aliases] => Array
                (
                    [0] => google-public-dns-a.google.com
                )

            [addrtype] => 2
            [addrlist] => Array
                (
                    [0] => 8.8.8.8
                )

        )

)
Array
(
    [0] => Resource id #5
    [1] => 0
    [2] => stdClass Object
        (
            [name] => google.com
            [aliases] => Array
                (
                )

            [addrtype] => 2
            [addrlist] => Array
                (
                    [0] => 74.125.136.113
                    [1] => 74.125.136.102
                    [2] => 74.125.136.100
                    [3] => 74.125.136.138
                    [4] => 74.125.136.101
                    [5] => 74.125.136.139
                )

        )

)

Any ideas how I can make custom queries? MX. SOA, TXT, ....

xming commented 11 years ago

Ah got it

ares_search($a, "cb", "google.com", ARES_T_MX);
ares_search($a, "cb", "google.com", ARES_T_SOA);
igorw commented 11 years ago

Cool, I was probably missing the OSX support.

xming commented 11 years ago

Isn't that patch from you? :D

chobie commented 11 years ago

yea, I sent a patch. but some features does not work properly on my osx :cry:

xming commented 11 years ago

Such as? Maybe I can test them here on linux.