response from website returns none with selenium - javascript

I would like to download some data from national animal remedy dept. Since it's a dynamic website, i choose the selenium to do it. But it still returns none from the website. Could anyone help? thanks
website address : http://124.126.15.169:8081/cx/
the problem is that the url above stayed the same no matter which field i click in the left side of the tab.
I don't know how to construct a request url to the server so that i can get the json file in the response data.
Could anyone point out how am I able to get the data?
Thanks a lot

Related

dynamically generate content for a page when clicking on product

everyone. I am making a website with t-shirts. I dynamically generate preview cards for products using a JSON file but I also need to generate content for an HTML file when clicking on the card. So, when I click on it, a new HTML page opens like product.html?product_id=id. I do not understand how to check for id or this part ?prodcut_id=id, and based on id it generates content for the page. Can anyone please link some guides or good solutions, I don't understand anything :(.
It sounds like you want the user's browser to ask the server to load a particular page based on the value of a variable called product_id.
The way a browser talks to a server is an HTTP Request, about which you can learn all the basics on javascipt.info and/or MDN.
The ?product_id=id is called the 'query' part of the URL, about which you can learn more on MDN and Wikipedia.
A request that gets a page with this kind of URL from the server is usually a GET request, which is simpler and requires less security than the more common and versatile POST request type.
You may notice some of the resources talking about AJAX requests (which are used to update part of the current page without reloading the whole thing), but you won't need to worry about this since you're just trying to have the browser navigate to a new page.
Your server needs to have some code to handle any such requests, basically saying:
"If anybody sends an HTTP GET request here, look at the value of the product_id variable and compare it to my available HTML files. If there's a match, send a response with the matching file, and if there's no match, send a page that says 'Error 404'."
That's the quick overview anyway. The resources will tell you much more about the details.
There are some solutions, how you can get the parameters from the url:
Get ID from URL with jQuery
It would also makes sense to understand what is a REST Api and how to build a own one, because i think you dont have a backend at the moment.
Here some refs:
https://www.conceptatech.com/blog/difference-front-end-back-end-development
https://www.tutorialspoint.com/nodejs/nodejs_restful_api.htm

Using data from webpages to make a calculation

I would like to extract specific data from a webpage then open a specific webpage based on what that data is. In the form of an if statement.
Say for example I google the olympics (https://www.google.com/#safe=off&hl=en&q=olympics&btnK=Google+Search)
It says it is in "Rio" right now. Say based on "Rio" I have a link that directs to Wikipedia and if it said something other than "Rio" it directs to www.google.com. I need to find a way to be able to pinpoint the data I need from another webpage then make a decision based off of that. The hard part being assigning that data to a variable.
I would like to do this in jQuery if at all possible. If not what language what I need to do this? Is there a specific name for this type of thing (pulling data off of webpages) and are there any resources so I can learn more about it?
Thank you
I think its what you are looking for. Correct me if i'm wrong
You can use the PHP method on a file called go.php
<?echo get_file_contents($_GET['a']); ?>
and call it from AJAX using:
$.get("go.php?a=https://google.com", function(data){
//Your code....
});
IMPORTANT: DON'T FORGET THE HTTP OR HTTPS, if you forget it, go.php will try to find google.com in your server.
This method doesn't load the images because it tries to load them from your server

Querying server for files

This is a very general question, but I hope someone can help because I'm very new to web development.
I'm trying to program a simple blog system into my website. My idea was to have a form on my website where I could type up my article, then hit upload. The article would be sent, and saved, to the server using a Java Servlet.
My question is, how would I query the server for all those articles? Is there a way to do it in JavaScript? How does the client know what files to request from the server? If anyone could point me in the write direction, I would be very grateful because I have no idea what I'm doing!
When the articles are uploaded to the servlet, they have to be saved in some database.
On the client side you have to provide a hyperlink or menu option to view all the articles.
When the user clicks on the 'View All Articles' link it should call the servlet. The servlet has to fetch the records from the DB and put them in a list. This list then has to be added to a response object such as response.setAttribute("articleList",<your_list_of_articles>)
Now use the requestDispatcher object to forward the response to a jsp page.
In the Jsp page iterate through the list and display the articles.
If you want to display only specific articles, then instead of hyperlink to the 'View All Articles' page you can provide a form which takes the title of the article as parameter and submits to the servlet.
Your must be uploading the content in the pure text format. Receive it on server side i.e Servlet. Save this text with some more data related to blog author, data and an unique id in the data base using JDBC.
Now for retrieval, first you can list all the blogs on a page with anchor tag of author name.
Anchor should be like this.
Author name
Now on servlet you will have the blog id. use this id to retrieve the blog and return it to the browser.
This is a very rough explanation according to what you have asked.
Feel free to add more detail to question to get more specific answer.

Response of Ajax Request not in English

Basically i created an online API to scrape data from the Google play store, the API was working fine on my localhost server and everything was according to what I designed but, after uploading the API to my online server, when i send request to scrape data from the Google play store, it returns me in a foreign language, which Google translate says is "INDONESIAN"
So i did some research and modified the headers, currently these are my headers:
header('Content-Type: application/json');
header('Accept-Encoding: gzip');
header('Accept-Language: en');
header('Content-Language: en');
All of them are declared in PHP, but nothing happened, response is still in "INDONESIAN". I am getting what i want, just not in the desired language; please answer as quickly as possible
Found the answer in another post completely different than this,
i just had to append the "&hl=en" at the end of the play store link to make it open in english only like
https://play.google.com/store/apps/details?id='.$appPackageName.'&hl=en
Google Play's language in English

Problem with Joomla urls

Hi I have problem with url rewrite on my site..My situation is, that the site is fully ajax loaded and I am changing hash in url to navigate within the site..When someone put the hashed url into his browser, it would load correctly..With this I had first problem, with links for example on facebook and to with copied links on the site..These links are only SEF urls produced by joomla, so I when people comes to the site for example from facebook with this link, I have to parse it and change to the hashed on..Simply it has to be consistent..It all is fully working, but today I got another problem with links in newsletter sent from Joomla..These ones arent parsed by Jrouter, so I have another problem with parsing these ones into hashed form..It is getting to be pretty much complicated, si I am asking if someone here know some best practices to get the kind of behaviour to work..
I apologize for my English, its maybe kind obscure:)So below are some links with description, I hope you will get it, and sould help me;)
http://www.designclub.cz/ --base url no problem, when you will click on links the hash would change
http://www.designclub.cz/#en/realizace-prehled --hashed form of url..again without problems
http://www.designclub.cz/index.php/en/design --nonhashed url but in SEF form..again working
http://www.designclub.cz/index.php?option=com_content&view=article&id=95:bongio-koupelny&catid=13&Itemid=14 --raw url and here it comes..Joomla would accept it, but there is the non-hash url detection, so there is problem, it will stuck on 404, but it is not the main point..It is easy to fix..but I need to parse it into hashed one..I hope you understand..Normally I would be able to parse into correct form, but there is problem, that in SEF url are names od sections and categories insteas id's in nonSEF url..And I really dont want to requets these names from database..it is possible, but it is too horrible:)
So again sorry for this mashup of czenglish and thanks for your help:)
So already solved..It isnt perfect, but who cares:D Now I am detecting the ? position in url as condition to reparse it..If is question mark in url I let it be and change on next ajax request(my links which from can be done ajax request have all the sef url, so I can simply parse it into hashed form)

Categories