خرید بک لینک

Vote count: 0

I am working on controlling my TP-Link SC4171G PTZ controls in android. The urls for controlling ptz is : http://admin:admin@IP/cgi-bin/operator/ptzset?move=X where X could be up, down, left, right, upright,upleft, downright, downleft. here admin:admin reflects useame:password.

When i put the following url in browser address bar it works perfectly but when im doing it with HttpClient get request it just wont work.

My code is:

 public void CameraControlManager(final String Direction)
    {
        Thread thread = new Thread(new Ruable(){
            @Override
            public void run() {
                //code to do the HTTP request

                try {
                    GET("http://admin:admin@192.168.0.120/cgi-bin/operator/ptzset?move="+Direction);
                }catch (Exception e)
                {
                    Toast.makeText(DoorControl.this,e.getMessage().toString(),Toast.LENGTH_LONG).show();
                }
            }
        });
        thread.start();
        //"http://admin:admin@192.168.0.120/cgi-bin/operator/ptzset?move=up"

    }

    public static void GET(String url){
        InputStream inputStream = null;
        String result = "";
        try {
            final HttpParams httpParams = new BasicHttpParams();
            HttpCoectionParams.setCoectionTimeout(httpParams, 30000);
            HttpClient httpclient = new DefaultHttpClient(httpParams);

            HttpResponse httpResponse = httpclient.execute(new HttpGet(url));
            inputStream = httpResponse.getEntity().getContent();
        } catch (Exception e) {
            Log.d("InputStream", e.getLocalizedMessage());
        }
    }

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 15 خرداد 1395 ساعت: 19:55

صفحه بندی