Tampilkan postingan dengan label http. Tampilkan semua postingan
Tampilkan postingan dengan label http. Tampilkan semua postingan

Transferring user to new web page automatically

Posted by Unknown Kamis, 14 November 2013 0 komentar
 
<META HTTP-EQUIV="Refresh" CONTENT="2;URL=http://eazyprogramming.blogspot.in/">
Use the code above inside your head tag and your web page will be redirected to "http://eazyprogramming.blogspot.in/" within 2 seconds.
Change the value of CONTENT="2" to some other integer to decrease or increase the delay of redirection of webpage.If "0" is given the change will be seen immediately.

Baca Selengkapnya ....

Connecting to a remote mysql database using php and Android?

Posted by Unknown Sabtu, 04 Mei 2013 0 komentar
Connecting to a remote database has been a Herculean Task for some programmers. No more worries here is a simple post to make it really simple. Follow these steps exactly to get it done.

Remember these when you are working with an online database.

1. Make sure that you have a running server.
2. INTERNET permission should be present in the AndroidManifest file of your app.
3. The path that you give in your program to point to the server file should be correct.

After ensuring all these you are ready to go.

First we will start with the Server side. Here I am going with a PHP example.

I am getting a value from the Android side by using a variable say "my_val".
Then the PHP script will look like this.
Note that here I am only sending one value from the Android side to the PHP Side.
so the Server side code will look like this.



$val = $_POST['my_val'];
echo $val;


Look at the varaible name inside the $_POST. Make sure that you use the same variable name in the Android side also. It is also case sensitive.

Here I am echoing back any value that is sending from the Android side.
You can do anything with it in the server side. Here I am just echoing it back.
You can simply insert it into a database and echo something else. Anything you echo will be received by the Android

Our Server side code is complete
Now we switch on to the Android side.

This is the code that connects with the server.



Thread thread = new Thread()
{
@Override public void run()
{
try
{
httpclient=new DefaultHttpClient();
httppost= new HttpPost("your url");
}
}
// make sure the url is correct.
//add your data
nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("my_val","my Test value from the Android Side"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
//Execute HTTP Post Request response=httpclient.execute(httppost);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
final String response = httpclient.execute(httppost, responseHandler);
System.out.println("Response : " + response);
}
catch(Exception e)
{
System.out.println("Exception : " + e.getMessage());
}
}
};
thread.start();



If you are working on LocalHost use url "http://10.0.0.2/your_folder_address.php"

OK Done. You have successfully connected to a remote server. Check your LogCat for the value from the server Make sure you have internet connection before doing this, otherwise exception will be thrown. By this way you can send any number of variables from the Android side to the PHP side but make sure that both have the same name (case sensitive).

Baca Selengkapnya ....

What are webservices? How we can use in Android?

Posted by Unknown Senin, 04 Maret 2013 0 komentar
A web service is any piece of software that makes itself available over the internet and uses a standardized XML messaging system. XML is used to encode all communications to a web service. For example, a client invokes a web service by sending an XML message, then waits for a corresponding XML response. Because all communication is in XML, web services are not tied to any one operating system or programming language–Java can talk with Perl; Windows applications can talk with Unix applications.

Web Services are self-contained, modular, distributed, dynamic applications that can be described, published, located, or invoked over the network to create products, processes, and supply chains. These applications can be local, distributed, or Web-based. Web services are built on top of open standards such as TCP/IP, HTTP, Java, HTML, and XML.

Web services are XML-based information exchange systems that use the Internet for direct application-to-application interaction. These systems can include programs objects, messages, or documents.

A web service is a collection of open protocols and standards used for exchanging data between applications or systems. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Java and Python, or Windows and Linux applications) is due to the use of open standards.


To summarize, a complete web service is, therefore, any service that:
1. Is available over the Internet or private (intranet) networks
2. Uses a standardized XML messaging system
3. Is not tied to any one operating system or programming language
4. Is self-describing via a common XML grammar
Is discoverable via a simple find mechanism

An Example
Consider a simple account-management and order -processing system. The accounting personnel use a client application built with Visual Basic or JSP to create new accounts and enter new customer orders.

The processing logic for this system is written in Java and resides on a Solaris machine, which also interacts with a database to store the information.
The steps
illustrated above are as follows:

The client program bundles the account registration information into a SOAP message.

This SOAP message is sent to the Web Service as the body of an HTTP POST request.
The Web Service unpacks the SOAP request and converts it into a command that the application can understand. The application processes the information as required and responds with a new unique account number for that customer.

Next, the Web Service packages up the response into another SOAP message, which it sends back to the client program in response to its HTTP request.
The client program unpacks the SOAP message to obtain the results of the account registration process. For further details regarding the implementation of Web Services technology, read about the Cape Clear product set and review the product components.

In Android we can use it like an HTTP call. Several examples can be found on coderzheaven.com
Some of them are “connecting with php and android” where the php script can be called as a webservice which can be used by any system independent of the operating systems.


reference:
http://www.coderzheaven.com/2013/02/26/webservices-android/


Baca Selengkapnya ....
Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android populer.