0

这是我第一次在服务器上发帖(没有 php)

我必须在 www.myLink.com/user/ID1/value 之类的链接上发布请求,其中 id 是用户 ID,值是字符串。

我怎样才能发帖?

我试过了

HttpClient client = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(" http://myLink.com/user/");  
        try {
             // Add data
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("ID", "id1"));
            nameValuePairs.add(new BasicNameValuePair("VALUE", "The value to post"));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request
            HttpResponse response = client.execute(httppost);
            System.out.println("return della post " + response);
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
        } catch (IOException e) {
            // TODO Auto-generated catch block
        }

但不要工作。我有这个错误:

08-02 12:46:26.507: W/System.err(26293): java.lang.IllegalArgumentException: Illegal character in scheme at index 0:  http://karaoke.eu01.aws.af.cm/endpoints.php/user/facebook-share/
08-02 12:46:26.507: W/System.err(26293):    at java.net.URI.create(URI.java:727)
08-02 12:46:26.507: W/System.err(26293):    at org.apache.http.client.methods.HttpPost.<init>(HttpPost.java:79)

热 我可以发帖吗?

4

0 回答 0