Excuse me: How to specify IP and domain name crawl URL content
Source: Internet
Author: User
Ask: How to specify IP and domain name crawl URL content
Ask: How to specify IP and domain name crawl URL content
File_get_contents () Such a function, can only specify the domain name or IP address crawl URL content, but if the domain name resolves to the wrong IP address, if you specify both the domain name and IP address fetch URL?
In effect, an HTTP request is sent to the specified IP address, not to the address of the DNS resolution of the domain name in the request package.
is essentially a DNS hijacking, which can be achieved through the hosts file, but modifying the hosts is too cumbersome and cannot be implemented if it is a virtual host. So I want to implement this function on the level of PHP program, ask the person!
Here is a reference scheme: http://blog.s135.com/post/389/
Use a custom function to send the constructed HTTP packet via PHP built sock connection
But it is also troublesome, I do not know whether there is a simple and efficient way: using a library function like curl, when sending an HTTP request only a multiple destination IP address
------Solution--------------------
In that case, do you use the example he gave you?
In fact, his code is also an IP attempt, not the return false, the line will get the result
------Solution--------------------
His example is the use of IP rotation, he several IP points to the same domain name,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.