mssql 调用http 抓去源代码
--EXEC sp_configure 'show advanced options', 1
--reconfigure
--EXEC sp_configure 'Ole Automation Procedures', 1
--RECONFIGURE
declare @obj int
declare @mobile varchar(11)
declare @pressedkey varchar(5)
declare @checkurl varchar(200)
declare @url varchar(200)
declare @response varchar(2)
declare @result varchar(100)
declare @objend varchar(400)
set @mobile='13811052216'
set @pressedkey='1540'
set @checkurl='http://www.5151ka.cn/smsserver/greencheck.action?mobile='+@mobile+'&pressedkey='+@pressedkey
--这个需要java环境部署web程序
set @url='http://127.0.0.1:8000/sqlhttp/acceptService.action?mobile='+@mobile+'&pressedkey='+@pressedkey
exec sp_OACreate 'MSXML2.ServerXMLHttp',@obj out
exec sp_OAMethod @obj,'Open',null,'GET',@checkurl,false
exec sp_OAMethod @obj,'send'
exec sp_OAGetProperty @obj,'responseText',@response out
select @response [response]
--@response =-1 未授权 0=没卡 1=有卡
if @response='1'
begin
exec sp_OAMethod @obj,'Open',null,'GET',@url,false
exec sp_OAMethod @obj,'send'
exec sp_OAGetProperty @obj,'responseText',@result out
select @result --结果例子:syc2050285$676540 按$分割 卡号$密码
end
exec sp_OADestroy @objend
select LEFT('syc2050285$676540',charindex('$','syc2050285$676540')-1) as kahao
select RIGHT('syc2050285$676540',LEN('syc2050285$676540')-charindex('$','syc2050285$676540')) as pwd