java - Error in accessing HTTPS link, shows 403 forbidden and UnknownHostException -


i making app listen online radio. sent https radio site it.hplayradiostream("https://radio.itechnepal.com/pathibhara/stream");

so tried access input stream using following code:

 private static void hplayradiostream(string spec) throws malformedurlexception, ioexception, javalayerexception {      try{  url url= new url(spec);     httpsurlconnection huc= (httpsurlconnection) url.openconnection();        inputstream response= huc.getinputstream();       player player= new player(response);       player.play();      }        catch(exception e){          system.out.println(e);      }     } 

and gives 403 forbidden error. tried implementing using sslsocketfactory using following code:

   private static void hplayradiostream(string spec) throws malformedurlexception, ioexception, javalayerexception {      try{         security.addprovider ( new com.sun.net.ssl.internal.ssl.provider());      system.setproperty ("java.protocol.handler.pkgs",                   "com.sun.net.ssl.internal.www.protocol");  sslsocketfactory factory =               (sslsocketfactory)sslsocketfactory.getdefault();           sslsocket socket =               (sslsocket)factory.createsocket(spec, 443);              socket.starthandshake();   inputstream response= socket.getinputstream();       player player= new player(response);       player.play();      }        catch(exception e){          system.out.println(e);      }     }  

and gives unknownhostexception. when tried access ip address, using "nslookup" ,"tracert" , "ping" , couldn't find domain or show non-existent domain. if non-existent why original site playing same stream here: http://www.pathibharafm.org/. browser shows 403 forbidden message while pasting stream link in next tab. please help.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -