共享主机上域的IP地址 [英] IP address of domain on shared host

查看:67
本文介绍了共享主机上域的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在共享托管服务提供商上拥有域。如何使用Python查找域的直接IP地址?

I have domain on a shared hosting provider. How do I find the direct IP address of my domain using Python?

是否可以使用IP地址而不是网站本身发布到域中的脚本?

Is it possible to post to a script on my domain using the IP address and not the website itself?

谢谢。

推荐答案

一个好奇的请求...

A curious request ...

要查找域名,请执行以下操作:

To look up a domain name, do something like this:

import socket
ipaddress = socket.gethostbyname('www.bbc.co.uk')

关于发布到IP地址:
,我认为它无法正常运行(例如通过浏览器),因为在该地址下可能会有很多站点。

Regarding posting to the IP address: I don't think it would work in the normal way (like from a browser), because there will probably be many sites held under that address.

但是,如果您将客户端套接字连接到站点的IP地址,但仍将站点的名称发送到网站的IP地址中,我想您可以使用编程语言(例如Python)以非常手动的方式进行操作HTTP主机请求标头。

But, I guess you could do it in a very manual way, using a programming language (e.g. Python), if you connected a client socket to the site's IP address, but still sent the website's name in the HTTP Host request header.

我不知道这带来的问题多于答案,而且我也不知道为什么要这么做

I don't know if that poses more questions than it answers, and I don't know why you'd want to do either of the above, but there it is.

祝你好运!

这篇关于共享主机上域的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆