A
A
Alex2013-12-19 12:39:16
PHP
Alex, 2013-12-19 12:39:16

Loading a string from the whois service

Task:
For example, there is a list of 100 ip addresses of some servers on the Internet in the database. The task, when displaying this list in the browser, on the html page, is to load the "netname" line from the whois service, which contains the name of the company that owns this address, to each ip.
Solutions that came to my mind:
1. using php, namely file_get_contents(), load pages in a cycle by the url in which ip is entered from the list, then cut out the company name with a regular expression, etc. For 100 ip, the solution is probably very good. bad, because it will take a very long time to wait for our page with the ip list to load.
2. using ajax to load the same pages from whois, when the page with the ip list has already opened in the browser, cut out what we need with the same regexp and substitute it in the open page.
Namba question 1: is there any logic in these decisions at all? Is there another way to solve the problem?
Namba question 2: tell me a little about the second option, if it is suitable, I'm not strong in javascript yet, how to implement this solution, what could be the pitfalls?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2013-12-19
@pushthebutton

1. And you cache. They pulled the whois service, parsed the page, got the netname and saved it to the database.
I don't think the IP-address - NETNAME link will change five times a day. It is enough to save the list once a month, and then display it to users from the local database.
You can go further, create a functionality to update a specific IP, if the user wants to update only one address, knowing its current, current, netname. The algorithm is the same.
2. It won't work through ajax, it's better to use xmlhttprequest. But the first option is still preferable (since it is possible to use the cache)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question