Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:14:39+00:00 2026-06-15T03:14:39+00:00

I have to make a request to a nameserver. the socketpart is working like

  • 0

I have to make a request to a nameserver. the socketpart is working like a charm, but to create the package I have some problems.

$domainname = "google.nl";

$hexdomain = ascii2he($domainname);

$package = "\x01\x01\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x0b".$hexodmain."\x00\x00\xff\x00\x01";

this should be the package i send to the nameserver but the package is not correct. what is the right way to create $package

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:14:41+00:00Added an answer on June 15, 2026 at 3:14 am

    First, the name you pass to the nameserver is not dot-separated, but every part of the name is transmitted separately.

    Second, you do not send the data converted to hex, but send them directly. The hex (\x01\x01) is just the representation.

    So you would encode your google.nl in the form "\x06google\x02nl\x00", as each of the name parts is preceded by its length, and the last one is succeeded by a \x00 meaning the empty string – which in turn denotes the end of the names chain.

    So in order to remain variable, you should split your domain name into its components and precede each of them with the corresponding length byte.

    Something like

    function domain2dns($domain)
    {
        $split = explode(".", $domain);
        $target = ""; // cumulate here
        foreach ($split as $part) {
            // For every $part, prepend one byte denoting its length.
            // strlen($part) is its length which is supposed to be put into one character.
            $target .= chr(strlen($part)).$part;
        }
        return $target . "\x00";
    }
    

    might be useful to do

    $domainname = "google.nl";
    
    $dnsdomain = domain2dns($domainname);
    
    $package = "\x01\x01\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00" . $dnsdomain . "\x00\xff\x00\x01";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a cURL request to a https URL, but I have
I have to make a few request to get some data from third party
I have to make a web request but its format creates problem for me.
We've sets of webservices and we have to make request on clientside (sending request
I have to make xPath dynamical, based on my request attributes in XSL file
I have a ASP.NET website. If I make a request for a page it
We have a request from many customers to make our datepickers reflect the date
One of my activities make a http request to a webservice to get some
I have several thousands of files, some of them contain HTTP request and some
I have to make a JSON ajax request and have an array in return.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.