Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: My post to http doesn't support hashtag not even via html code

  1. #1
    Junior Member
    Join Date
    Feb 2022
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy My post to http doesn't support hashtag not even via html code

    Hi everyone!
    I have a code to send a post to my social network via API using this code:

    true == function()
    {
    var getMyItem = function (str)
    {
    if (sessionStorage.getItem(str) == null)
    {
    setMyItem(str, 0);
    return 0;
    }
    return sessionStorage.getItem(str);
    }
    var setMyItem = function (key, value)
    {
    sessionStorage.setItem(key, value);
    }

    function bot(post)
    {
    const Http = new XMLHttpRequest();
    var Token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // Token
    var ID= "xxxxxx";
    var url= 'https://bot.xxx/api/'+Token+'/sendMessage?text='+post+'&chat_id='+ID;
    Http.open("GET", url);
    Http.send();
    }

    When it comes to call the post like this code,:
    var myDate = new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1");
    var post_n = "Hi. It's: " + myDate + "\n";
    var post = encodeURI(post_n);

    if (getMyItem(key + "htr") != "yes")
    {
    bot(post);
    setMyItem((key + "htr"),"yes");
    }


    return true;
    }
    }()
    It doesnt support # sign in my browsers including Chrome an Firefox and nothing is sent actually.
    So if it was for Telegram, the bot was this (and I donno if it works or not but I'm talking about another SN):
    var url= 'https://api.telegram.org/'+Token+'...

    Please tell me how to send # code. By the way, "%23" doesn't work.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: My post to http doesn't support hashtag not even via html code

    What language is that? It does not look like java.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2022
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: My post to http doesn't support hashtag not even via html code

    I'm not an expert. I know it works anyway but the problem is with # sign.

  4. #4
    Junior Member
    Join Date
    Feb 2022
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: My post to http doesn't support hashtag not even via html code

    Has anyone got a solution?

Similar Threads

  1. Why Java Doesn’t Support Multiple Inheritance
    By Nirali in forum Java Theory & Questions
    Replies: 10
    Last Post: December 10th, 2018, 05:12 AM
  2. Replies: 6
    Last Post: August 5th, 2014, 11:19 AM
  3. HTTP post to html servlet
    By Mith in forum Java Theory & Questions
    Replies: 1
    Last Post: October 23rd, 2012, 11:18 AM
  4. [SOLVED] Make JTextArea Support HTML
    By bgroenks96 in forum AWT / Java Swing
    Replies: 12
    Last Post: August 28th, 2011, 01:01 PM

Tags for this Thread