调用一个URL,而无需打开浏览器窗口 [英] Call an URL without opening a browser window

查看:152
本文介绍了调用一个URL,而无需打开浏览器窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我用来注册一些项目的aplication至极。我想thoose,存储在一个在线数据库为此事我创建的通过URL接收变量,并将它们添加到数据库的简单的PHP页面。我能得到的东西通过调用浏览器的意图和打开URL迅速工作,但那是一种无聊的。是否有任何其他的方式来打电话给我的网址,而无需打开浏览器,仍然运行PHP code?

I have an aplication wich I use to register some items. I want to store thoose at an online database, for that matter I created a simple php page that receives the variables via URL and adds them to a database. I can get things working swiftly by calling the browser intent and opening the URL, but thats kind of boring. Is there any other way to call my URL without opening the browser and still run the php code?

推荐答案

这将是一个Web服务调用,看到这个线程...的如何调用与Android Web服务

It would be a web service call, see this thread... How to call web service with Android

从技术上讲,任何时候你调用的Web URL做一些事情(例如:它通过URL接收变量,并将它们添加到数据库的简单的PHP页面)的Web服务。现在,你的情况可能它不使用SOAP和有一个WSDL,但它更多的是基于REST的类型设置,在其中发布数据并对其进行处理的。

Technically, any time you call a web url to do something (ex: a simple php page that receives the variables via URL and adds them to a database) its a web service. Now in your case its likely it does not use SOAP and have a WSDL, but its more of a RESTful type setup, in which you post the data and it processes it.

HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet httpGet = new HttpGet("http://www.example.com/" + URL);
response = httpClient.execute(httpGet, localContext);

这篇关于调用一个URL,而无需打开浏览器窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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