Get HTML <input> value in Java [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I've searched arround on Google but couldn't find a clear answer on my question. The idea of what I want to do is quite simple:
There's a site called "glws.org" with a bunch of <div>'s and <input>'s on the page. You can add strings to the URL (example: https://glws.org/#S76561198105687636A2280482163D16883436630920468625) and for different strings after the # in the URL, different values are put into the <input>'s. The site reads the string after the # and has a script that converts it into values and puts the values in read-only <input>'s. Because they are <input>'s and not <p>'s for example, I can't just read them by printing out the HTML code.
Is there a way to retrieve the value in the input fields through a Java program? I've tried to read the source code of the page with Sockets but that obviously just prints the <input> tags without the value because it's not like a <p> or something.
Any help is appreciated!

You can use Selenium web driver to do browser actions on the website programatically and wait till some elements appear on the page.
https://code.google.com/p/selenium/wiki/GettingStarted

Related

Calculate index of character in google doc, on 100th page, Same as how SAVE API call does [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have really struggled a lot on this problem. I want to find the character index in google docs which have 150 pages.
What I want:
exact character index of on the page text click,
Reference: What i saw Save API, gets that information somehow, you can check by following the below steps.
go to page 100th in a google document by scrolling.
open debugger and check SAVE API call after editing in the document.
Check the request body "ibi" property will give you the exact index.
I want to get that index on page text click.
Currently, It is not possible for apps script to capture client side DOM events. Also, there is nothing in the official documentation about capturing selection from document. Though selection capture is possible both in Sheets and Slides.

How can I fetch the TITLE of my html page? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I need to fetch the contents under MY TITLE to appear as title within an image on the same page. For example this is a link from my blog and the title of the page appears within the image.
Just a code to fetch my title and use it within an image without having to copy paste manually every time. The structure of my URL is (title.php)
I presume you meant the page's title at the browser's tab, right? (question was a bit unclear)
If so, this value can be accessed in Javascript using
document.title
This is the cleanest way to get it, and the most effective one. There is a weird play if you want to use purely PHP to get it, however, I would stick to using this method if I were you.
For reference, here is the previous SO topic on getting page title in PHP
How to get page title in php?
If you wanted to use that value in PHP, you could use Javascript inside PHP by simply writing
echo '<script type="text/javascript"> document.title </script>';

How to detect presence of Javascript in plain HTML using PHP? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have plain HTML code, without Javascript code in it.
How would you detect if any form of Javascript was injected in the HTML ?
The application generates HTML client side. And needs to validate it once it arrives on the server.
The goal is NOT to remove Javascript, but simply detect the presence of it.
This is what tools like HTML Purifier are for. They break the input into tokens are run them against a white list.
This is safer than trying to find specific ways of inserting scripts into HTML, because there are tricks with malformed tags or non obvious attributes being used. See the XSS Evasion Cheat Sheet for example.
Removing can be easier than detecting - just escape all the HTML etc. you get with htmlspecialchars($string).
Alright, so this is a very interesting challenge:
First, check for all script tags, both capital and lowercase
<SCRIPT> <script> <sCrIPt>
Then, check for event handlers (onclick etc).
For this, we use DOM
$dom = new DOMDocument;
$dom->loadHTML($string);
You can work all sorts of magic with DOM, I recommend reading their documentation. Check for any attributes with "on" in them

Is it possible to use the Twitter API to feed tweets into a local text file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am using a projection mapping programme, with part of the project taking text from a local text file, and inserting it into the programme.
Instead of manually filling this text file with pre-populated content, is it possible to use the Twitter API to feed in tweets to this local text file?
I'm not very familiar using javascript to access twitter's API, but you should be able to achieve that using twit.
Depending on the number of data you're wanting to obtain, the streaming API will be a better option. This will give you a large number of data with less likelihood of reaching a limit.
If you have more question regarding that specific package, you should give it a try (plenty of examples available) and post specific questions with proper tags (i.e. javascript, twit)

Save div = contenteditable to MySQL using PHP and JS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Is there any possibility to save a DIV, that has contenteditable="true", to a MySQL Table? I need to use PHP for this (and JS as a "helper").
I though of doing something like this:
Putting a button on the site that copies the content of the contentEditableDIV to a formDIV (a DIV that is in a form with method="POST" action="send_to_mysql.php").
The button is supposed to auto-trigger the submit button/function at the same time.
But is there any other, more convenient way? I am quite a beginner in MySQL, so I couln't think of any other way yet.
I appreciate any kind of help or response.
With best regards,
Dave
Conceptually...
//contenteditable element
//read element with JS
//URIencode to PHP via JS/AJAX
//Send to database with PHP/PDO
You're in for a real can of worms if you want this to work well. Especially if you want this to work well AND be able to accept pasted content from MS Word.

Categories