0

Thanks to all of you in advance :)

I want to send Headers in android to my shoutcast server. I need to connect this address:

 http://s7.voscast.com:8234

and get response. I response is

GET / HTTP/1.(0|1)

Then again send header pass=somePassword

And I want to check what will be the response for pass?

SJSSoft
  • 723
  • 2
  • 10
  • 28
  • What are u using to send Http Requests ? – Decoy Jul 16 '14 at 13:49
  • Are you trying to make a SHOUTcast source client? If so, it's not HTTP. – Brad Jul 17 '14 at 12:38
  • I want to broadcast from my phone. In other words, I want to use my mobile to get voice from and send to a shoutcast server. To understand this concept, I asked a question a few days ago i.e. [http://stackoverflow.com/questions/24709739/stream-from-android-device-to-shoutcast-upstreaming](http://stackoverflow.com/questions/24709739/stream-from-android-device-to-shoutcast-upstreaming). So I got that it uses ICY Protocal which is very similar to HTTP with some extra features. And to connect to a shoutcast server, I have to send request in headers. – SJSSoft Jul 17 '14 at 12:52

1 Answers1

1

assuming that you are using import org.apache.http.client.*

it would be a simple:

HttpGet request = new HttpGet(url);
request.setHeader("X-AUTHORIZATION", token);

There are also methods like setEntity:

HttpPost request = new HttpPost(url);

            request.addHeader("X-AUTHORIZATION", token);
            request.addHeader("Content-Type", "application/json");

            StringEntity se = new StringEntity(jsonPost);
            request.setEntity(se);

see: http://developer.android.com/reference/org/apache/http/client/HttpClient.html

erik
  • 4,946
  • 13
  • 70
  • 120