ASP 获取腾讯IP地址的代码
来源:asp之家 发布时间:2011-02-26 11:19:00
代码如下:
<script type=text/javascript src=http://fw.qq.com/ipaddress></script>
<script type=text/javascript>
var hehe1=IPData[2]
var hehe2=IPData[3]
alert(hehe1);
alert(hehe2);
document.write(IPData.join(' '));
</script>
如何用ASP来存储,从上面读取出来的数据呢。
回答:
代码如下:
<%
function GetResStr(URL,code)
err.clear
dim Http,ReturnStr
Set Http=server.createobject("Microsoft.XMLHTTP")
Http.open "GET",URL,False
Http.Send()
If Http.Readystate =4 Then
If Http.status=200 Then
ReturnStr=BytesToBstr(http.responseBody,code)
GetResStr=ReturnStr
End If
End If
End Function
'函数名:BytesToBstr
'作用:转换二进制数据为字符
'参数:Body-二进制数据,Cset-文本编码方式
Function BytesToBstr(Body,Cset)
Dim Objstream
Set Objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset =Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
dim vUrl,TempStr
vUrl="http://fw.qq.com/ipaddress"
TempStr=GetResStr(vUrl,"gb2312")
response.write "您的IP为(asp获取真实IP):"&split(TempStr,"""")(1)" " &split(TempStr,"""")(5)" "&replace(split(TempStr,"""")(7),"市","")
%>
猜你喜欢
- 内置方法 说明 __init__(self,...) 初始化对象,在创建新对象时调用 __del__(self) 释放对
- 在python中安装了lxml-4.2.1,在使用时发现导入etree时IDE中报错Unresolved reference其实发现,不影响
- 每天都要记得健康打卡尊敬的老师,我忘了这次的健康打卡,反思的时候我想了很多东西,反省了很多事情,自己也很懊悔,触犯了学校的规定,深刻认识到自
- 用到这个的业务场景是这样的:a页面点击新建列表按钮进入到新建的页面b,填写b页面并点击b页面确认添加按钮,把这些数据带到a页面,填充到列表(
- asp使用fso对象遍历目录及目录下的文件代码:<%@ Language=VBScript %><%&
- 0.引言自己在下载dlib官网给的example代码时,一开始不知道怎么使用,在一番摸索之后弄明白怎么使用了;现分享下 face_
- PYQT5中给listwidget的滚动条添加滚动信号self.listWidget.verticalScrollBar().valueCh
- 前言内存映射通常可以提高I/O的性能,因为使用内存映射时,不需要对每个访问都建立一个单独的系统调用,也不需要在缓冲区之间复制数据,内核和用户
- 问:怎样解决mysql连接过多的错误?答:系统不能连接数据库,关键要看两个数据:1、数据库系统允许的最大可连接数max_connection
- 目录背景实现工具打包调用总结众所周知,Golang 适合写 CLI 工具,但你可能还不知道 Golang 还可以打包配置文件。背景最近在写一
- 本文实例为大家分享了python实现图书借阅系统的具体代码,供大家参考,具体内容如下部分代码:from flask import Flask
- 在JavaScript中,阻止表单默认提交行为的方法有两种,分别是:(1) return false示例代码<form name=&q
- 英文文档:setattr(object, name, value)This is the counterpart of getattr().
- 类的定义# class是定义类的关键字,ClassName为类的名称class ClassName:# 在这里写其他内容passclass
- 一. 数据的格式首先我们需要x,y,z三个数据进行画图。从本实验用到的数据集KITTI 00.txt中举例:1.000000e+00 9.0
- 在用户体验量化方法研究(一)中,我们以用户体验层次模型为基础,提出了三种量化用户体验的方法:以任务为中心、以行为为中心以及以体验为中心的量化
- 1 动机greenlet 包是 Stackless 的副产品,其将微线程称为 “tasklet” 。tasklet运
- 一、模块概述模块指的是包含python代码的文件,也就是一个.py文件就是一个模块。文件夹(directory)---->包(pack
- 一、前言今天分享一个Python 制作透明背景的电子印章的代码,代码是通过网络获得并整理的,大家可以参考和学习。二、步骤解析代码我已调试过了
- 有产品表,包含id,name,city,addtime四个字段,因报表需要按城市分组,统计每个城市的最新10个产品,便向该表中插入了100万