Questions tagged [httpurlconnection]

The HttpURLConnection instance is specifically utilized for sending out individual requests. However, it is important to note that the network connection with the HTTP server may be shared by other instances without the need for manual intervention.

How can I establish a connection between my Android app and a PHP server using HTTPUrlConnection to send data in the output stream and ensure that the server receives it in the $_

When using HttpURLConnection to send a JSON query to a PHP server, I encountered issues with the communication not working as expected. Despite having a successful connection and receiving proper error responses from the server side, it seems that the PHP ...

Retrieving the data payload from a 400 response using HttpURLConnection

When making a JSON request to my web service, I return a 400 message code with a detailed JSON error response if the request is bad. But how can I retrieve this payload on the client side using HttpURLConnection? The connection's InputStream is null a ...

Parsing JSON sub items in Android application using Java

Here is a snippet of my PHP file: <?php $myObj = array( "name"=>"John" , "age"=>"30" , "post"=>[ "title"=>"What is WordPress" , "excerpt"=>"WordPress is a popular blogging platform" , ...

Transfer image data in JSON format by compressing it into a base64 string from an Android device to a PHP web

I am attempting to upload an image (compressed in base64) as a JSONObject from an Android device to a web service using PHP. I have tried using HttpURLConnection with the POST method. Here is my code in Android: try { JSONObject params = new ...

Step-By-Step Guide on Creating a Data Post Using HttpUrlConnection

Here is an AJAX code snippet I have: $.ajax({ url: 'http://www.whoisxmlapi.com/whoisserver/WhoisService', dataType: 'jsonp', type:'POST', data: { domainName: 'domaindomanin.com', outputFormat: 'json' }, success: fun ...

Sending JSON data in a POST request using Java's HttpUrlConnection

After spending time developing a Java code to convert the cURL request below into Java using URL and HttpUrlConnection, I've hit a roadblock. The original cURL is: curl -i 'http://url.com' -X POST -H "Content-Type: application/json" -H "Acce ...

Failure to read the response will cause the HttpUrlConnection request to malfunction

I have been attempting to send a json request using HttpUrlConnection in Java. Despite following multiple examples, I am unable to successfully add data to the server as there is no response. Below is the code I am currently using: URL url = new URL(u ...