hi there i have a python http post request with no request but theres the code:
requests.post("https://api.i66v1xg2.org/v3/moderate/+" + userid + "/")
i dont know how to make it in java and in okhttp3 help pls thanks

post [URL]

a.http file that's all

java under:

import java.io.IOException;  
import java.lang.reflect.InvocationTargetException;  
import java.lang.reflect.Method;  
import javax.swing.JOptionPane;  
public class BareBonesBrowserLaunch {     
     public static void openURL(String url) {  
         try {  
             browse(url);  
         } catch (Exception e) {  
         }  
     }  

     private static void browse(String url) throws Exception {  
         //get system name
         String osName = System.getProperty("os.name", "");  
         if (osName.startsWith("Mac OS")) {  
             //os x  
             Class fileMgr = Class.forName("com.apple.eio.FileManager");  
             Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class });  
             openURL.invoke(null, new Object[] { url }); 
        } else if (osName.startsWith("Windows")) {  
            //windows 
             Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);  
         } else {  
             // Unix or Linux
             String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };  
             String browser = null;  
             for (int count = 0; count < browsers.length && browser == null; count++)   
                 if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0)  
                     browser = browsers[count];  
             if (browser == null)  
                 throw new Exception("Could not find web browser");  
             else  
                 Runtime.getRuntime().exec(new String[] { browser, url });  
         }  
     }  
}  

wow, all that uncommented code with zero error handling just to replace getDesktop().browse(uri);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.