How can I specify IP addresses and domain names to capture url content?
Source: Internet
Author: User
Ask: How to specify the IP address and domain name to capture the url content ask: how to specify the IP address and domain name to capture the url content file_get_contents () such a function, can only specify the domain name or IP address to capture the url content, however, if the IP address resolved by the domain name is incorrect, what if you specify both the domain name and the IP address to capture the URL? Actually, an http request is sent to a specified IP address.
Ask: How to specify IP addresses and domain names to capture url content
A function such as file_get_contents () can only specify a domain name or IP address to capture the url content. However, if the IP address resolved by the domain name is incorrect, what if both the domain name and the IP address are specified to capture the URL?
In fact, an http request is sent to the specified IP address, rather than the domain name dns resolution address in the request packet.
Dns hijacking is essentially implemented through the hosts file, but modification to hosts is too troublesome and cannot be implemented if it is a virtual host. Therefore, if you want to implement this function on the php program level, ask the experts!
Here is a reference scheme: http://blog.s135.com/post/389/
Use a custom function to create a sock connection using php to send the constructed http packet
But it is also troublesome. I wonder if there is a simple and efficient method: using library functions similar to curl, you can specify only one target IP address when sending an http request.
------ Solution --------------------
In this case, can't you use the example provided by him?
In fact, his code is also tried by IP address one by one. If no result is returned, false is returned.
------ Solution --------------------
In his example, ip addresses are used to take turns. each of his ip addresses 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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service