java - Android YouTube Channel Videos Exception javax.net.ssl.SSLPeerUnverifiedException: No peer certificate -
i'm trying fetch youtube channel videos , i'm getting exception.
javax.net.ssl.sslpeerunverifiedexception: no peer certificate
below code.
strurl= https://www.googleapis.com/youtube/v3/search?key={your_key_here}&channelid={channel_id_here}&part=snippet,id&order=date&maxresults=20 @override protected string doinbackground(void... params) { try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(strurl); // response http request httpresponse response = httpclient.execute(httppost); statusline statusline = response.getstatusline(); // check http request success. if(statusline.getstatuscode() == httpstatus.sc_ok) { bytearrayoutputstream bytearrayoutputstream = new bytearrayoutputstream(); response.getentity().writeto(bytearrayoutputstream); content = bytearrayoutputstream.tostring(); bytearrayoutputstream.close(); } else { log.w("http1:", statusline.getreasonphrase()); response.getentity().getcontent().close(); throw new ioexception(statusline.getreasonphrase()); } } catch (unsupportedencodingexception e) { e.printstacktrace(); } catch (clientprotocolexception e) { log.w("http2:",e); content = e.getmessage(); error = true; } catch (ioexception e) { log.w("http3:", e); content = e.getmessage(); error = true; } return content; }
Comments
Post a Comment