读取url接口数据
string url = "http://localhost:8180/city-smscenter/smscenter?cmd=flowsms.queryMobileSmsList&mobile=" + channel1
+ "&startdate=2015-01-18%2016:50:34.015677&enddate=2020-01-20%2000:00:00";
public string jsonData(string url)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream ResStream = response.GetResponseStream();
Encoding encoding = Encoding.GetEncoding("UTF-8");
StreamReader streamReader = new StreamReader(ResStream, encoding);
//WebMessageBox.Show(streamReader.ReadToEnd());
string str = streamReader.ReadToEnd();
DataTable dt = JsonToDataTable(str);
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
读取url接口数据的更多相关文章
- java读取PHP接口数据的实现方法(四)
PHP文件: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 3 ...
- [PHP] java读取PHP接口数据
和安卓是一个道理,读取json数据 PHP文件: <?php class Test{ //日志路径 const LOG_PATH="E:\phpServer\Apache\logs\\ ...
- java读取url中json文件中的json数据
有时候需要远程从其他接口中获取json数据,如果遇到返回的json数据是一个文件而不直接是数据,那么可以通过以下方法进行读取: /** * 从数据接口获取到数据 * @return * @throws ...
- Ajax获取接口数据,url拼接参数跳转页面,js获取上一级页面参数给本页面
1.Ajax获取接口数据 function demo(){ //假设请求参数 var requestBody = [{ "name":"zhang", &quo ...
- django学习-12.访问不同url/接口地址实现对指定数据的增删改查功能
1.前言 通过前面博客[django学习-10.django连接mysql数据库和创建数据表]里的操作,我们已经成功在数据库[hongjingsheng_project]里创建了一张数据表[hello ...
- java异步线程池同时请求多个接口数据
一.主要使用类 . ExecutorService java线程池类 申明方式:ExecutorService exc = Executors.newFixedThreadPool(requestPa ...
- [转] PHP读取HTTP接口如何处理超时
原文地址:https://www.jianshu.com/p/446ea7aaea86 最近在工作中遇到一个读取 HTTP 接口慢的问题(使用的是 PHP 服务器端语言),所以想谈谈服务器端读取外部资 ...
- PHP常用接口数据过滤的方法
<?php /** * global.func.php 公共函数库 */ /** * 返回经addslashes处理过的字符串或数组 * @param $string 需要处理的字符串或数组 * ...
- 【转】java通用URL接口地址调用方式GET和POST方式
java通用URL接口地址调用方式GET和POST方式,包括建立请求和设置请求头部信息等等......... import java.io.ByteArrayOutputStream; import ...
随机推荐
- LeetCode第一题:Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific ta ...
- GWT实现平滑移动图片效果
在一些网站的首页上,顶部总会存在一些平滑移动的图片,一般用来投放广告或者业务介绍.多个图片只在一个区域展示,仅通过一些方法来不停的移动这个区域的图片来达到展示多个图片的目的.如果是普通的网页,使用Jq ...
- Spring集成Quartz定时任务框架介绍
在JavaEE系统中,我们会经常用到定时任务,比如每天凌晨生成前天报表,每一小时生成汇总数据等等.我们可以使用java.util.Timer结合java.util.TimerTask来完成这项工作,但 ...
- [iOS]UIImageView增加圆角
[iOS]UIImageView增加圆角 "如何给一个UIImageView增加圆角?有几种方法?各自区别?" 备注:本文参考自http://www.jianshu.com/p/d ...
- Resque基本
原文:http://www.cnblogs.com/rywx/archive/2012/05/26/2519615.html Resque resque是基于redis的后台任务组件,能把任何类或模块 ...
- 如何同时打开两个UltraEdit
高级—配置—应用程序布局—其它,勾上资源管理器选的文件将以独立的UltraEdit打开和允许多个UltraEdit
- Enable SVM while booted from alternate media (ZT)
http://www.seedsofgenius.net/uncategorized/solaris-tips-enable-svm-while-booted-from-alternate-media ...
- leetcode479
public class Solution { public int LargestPalindrome(int n) { ) ; , n) - ; ; v > max / ; v--) { S ...
- LNMP 1.3 测试php解析
测试解析LNMP的php解析 先打开nginx的配置文件 vim /usr/local/nginx/conf/nginx.conf location ~ \.php$ { root html; fas ...
- 用于确保页面中js加载完全,对于优化某网页的加载速度,有什么见解
js方法: <script type="text/javascript"> window.onload = function(){ var userName = &qu ...