Jump to content
  • 0

Question

Posted (edited)
private boolean isVotedInSite(String ip, VoteSite site)
    {
        try
        {
            // Make URL with vote site link with player IP address
            final URL url = new URL(site.getLink(ip));
            // Open connection
            final HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
            // Set User-Agent
            httpURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36");
            // Get response code and if everything is OK try to get answer
            final int response = httpURLConnection.getResponseCode();
            if (response == HTTP_OK)
            {
                // Get input stream from vote sites
                try (BufferedReader br = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream())))
                {
                    // Get answer from vote site which returns true/false
                    switch (site)
                    {
                        case L2HOPZONE:
                            return br.readLine().contains("true");
                        case L2TOPZONE:
                            return br.readLine().equals("TRUE");
                        case L2NETWORK:
                            return br.readLine().equals("1");
                        case L2TOP:
                            return br.readLine().equals("TRUE");
                        case L2BR:
                            return br.readLine().equals("1");    (if is correct or request correct read)
                    }
                }
            }

exampe of check is

 

https://top.l2jbrasil.com/votesystem/index.php?username=l2br&ip=0.0.0.0

 

have to get check of status. there is 1 (then player not voted is 0)

 

<votes><vote>

<site_id>id</site_id>

<ip>xxx.xx.xx.xx</ip>

<date>2017-04-24 19:34:07</date>

<status>1</status>

</vote></votes>

Edited by Crytek

3 answers to this question

Recommended Posts

  • 0
Posted (edited)

Try change to 

return br.readLine().equals("<status>1</status>");

or

return br.readLine().contains("<status>1</status>");

The return is a simple xml, may you can read it using DOM XML Parser

 

e.g.

doc.getElementsByTagName("status").item(0).getTextContent();
Edited by Grundor
  • 0
Posted

Optionally you can change the way you call.

 

 

By node: 

 

Or change to json output: 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Hello guys, There isn't much information to share yet regarding the project. We've been working on it for the past few months with the goal of creating something unique and truly different. Over the years, I've seen countless projects with the same features repeated over and over again. This time, we're aiming to build something solid and unlike anything players have seen before. Since many of you have been asking about Unreal Engine 5, I'd like to clear that up. Building something on UE5 requires a very large team and a lot of resources to accomplish properly. Right now, we can't say anything regarding UE5. Maybe in the future, who knows? Tzelal is a real life friend of mine. I've known him for many years, and he's a great guy. Right now, he's looking for people who genuinely want to be part of this project. The team is working 20+ hours a day, every single day. I'm often on calls with them, watching their progress and seeing everything they're creating. So, if anyone is wondering what's happening behind the scenes, my answer is simple, something amazing. I know many of you have been asking about features and other details, but we don't want to spoil anything just yet. There is still a lot of work to be done, and we'd rather reveal things when they're ready. Once everything is in the state we want, we'll start releasing sneak peeks. If you'd like to join the project, feel free to send Tzelal a private message so you can go through an interview. Please don't waste his time, or yours, if you're not genuinely interested. Now, I'd like to make a few things clear. No, we're not making another generic server with the same old features and the same old engine that you've seen for years. Our goal is to build something completely different, something that players haven't experienced before. And no, we're not going to give up on development. We work every day, and we keep pushing forward even when some challenges seem difficult. We're committed to making this project the best it can be. That's all for now. There will be much more to share once we're ready to show it. Thanks for your time, everyone.
    • 📢 MMORE.DEV — ONE SLOT AVAILABLE FOR A PROJECT   1 slot has opened up for long-term cooperation. We welcome anyone interested — we're looking for projects built for long-term collaboration, not one-off tasks.   🎯 We're ready to take on projects for these chronicles:   Essence Classic   Current protocols: 520, 542, 557+ One example of our developers' work — the Aden.Land team.   📋 We're also accepting preliminary discussions for the Main (GOD) branch — if you're planning a project on this chronicle, reach out in advance so we can go over the details and timeline. _______________________________________________________________________   For any questions — PM us or reach out on Telegram: https://t.me/L2scripts
    • 🔥 L2SCRIPTS BIG SALE 🔥 30-50% OFF ALL LEGACY PRODUCTS! Special offer for MaxCheaters users! Promotion runs from July 25 to August 1 inclusive _____________________________________________________    🎁 Promo details: 30-50% discount on all legacy studio products Source codes, ready-made builds, technical support — everything you've been wanting to grab at a great price. ___________________________________________________________________________   ⚡ Why you should hurry: A discount like this across the whole lineup is a rare event in our 20 years on the market This offer is strictly time-limited — exactly 7 days, no extensions Available only for MaxCheaters users Support slots are limited. ____________________________________________________ ✅ Proven quality — 20 years in the L2 market ✅ Full range of chronicles and ready-made solutions ✅ Personal support from our team ____________________________________________________   🌐 Our websites: L2-scripts.com — https://l2-scripts.com Mmore.dev — https://mmore.dev Telegram for contact: https://t.me/L2scripts ____________________________________________________   Don't miss your chance! In 7 days prices go back to normal — grab what you need at the best price in the studio's history. ➡️ Browse the product catalog: https://l2-scripts.com For any questions — PM us or check the support thread.
    • Is this a client built in unreal engine 5 or what ? I'm confused. Or is it a backend project ? Whatever it is good luck, may it be as "mighty" as its name !  
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..