Create a link based on table date on another website [closed] - php

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 am trying to think about how I would go about creating a link to something based on a data in another table on another website.
I have the following table on the other website:
https://i.imgur.com/Hlemt1y.jpg
so basically columns: Order #, Status, customer P-O
What I am trying to do is create a url based on "customer PO" that links to the Order #. So it would find the customer PO, then check the value on the same row of Order #, and then once I have that value I can create the URL using that order #.
I've never done anything that takes a value from another website so I guess that is what I am after?

If the other web page doesn't have an API that you can use to retrieve that data in a more usable format, you will have to use a technique known as scraping. you would likely use curl or wget to fetch the web page and then parse the resulting html page to pull the data you need out of it. an xml library would be able to assist in parsing, but you may be able to get away with a shortcut by searching the string for a common beginning and ending string.
so for example, if there is only one html table on the page, you can search for
<table>
and the matching
</table>
Then parsing the tr and td tags is a little more manageable than dealing with the entire page. In the end it just depends on what this is being used for and how robust it needs to be.

Related

Hide dynamic page "movie.php?id=10" from my PHP website's URLs and replace spaces with hyphens [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
My website's URLs are as:
"/movie.php?id=10 Rangoon (2017)"
Spaces are converted to %20 by web browser.
But I want the simple URL like this:
"/Rangoon-(2017)"
How Can I do that?
My website is developed in PHP and all data of my website is placed on MySql Database and "movie.php" page retrieves the data from MySql Database.
Well, that's not a simple one, you'll have to make many updates :
generate an url for each of you movie pages (By the way, don't use parenthesis in an url, in your example the url should be something like rangoon-2017). You may use my method
seoUrl
store this url somewhere in your database
Decide on an url scheme, like movie/title-of-your-movie
When displaying a link, display the url scheme
create an .htaccess file which rewrites movie/whatever to movie.php?url=whatever
On movie.php, retrieve your movie information from the url and not the id
Additional thoughts :
you'll have to make sure each movie has an unique url. Adding the year is a good idea, since I doubt two movies will have the exact same title and year.
also, make sure your urls are unique in the database (And indexed, since you'll search from them)
why the prefix movie/ on the url ? Simply because if you don't create it, you'll find more difficult to redirect other type of pages to the correct file.

Take data tables from other website [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 6 years ago.
Improve this question
how can I get all of the tables from http://www.imq21.com/market/summary this website? should I using DOM HTML?
Literally, you cannot get all the tables easily.
However, the table of that web site is not a flash. thus you can GET the entire raw HTML of that site, and applying Regular expression to parse the item one by one, and create your own class to store the output, and add the fetched data to the table your wanted.
Note:
it is not an API, thus you need to visit another link for another table and apply the same technique (Fetch HTML, regular expression, manipulate the data and store in the table) for all tables that you needed.
it maybe illegal or not regular to fetch data from other web site like that :D ... and if it is owned by you, you can simply write an API for your program to fetch the data directly (faster, and relatively lesser amount of work)

Multiple table data within same form [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 have a table called invoice_details consisting of :
id
invoice_id
product_id
product_name
quantity
price
I have a form field that allows input of the product name,qty,etc.
I want to add a column that will be called "room". The script I have now auto generates more form fields as I need them, in which I could add "room" and specify within the form field, but I want to have the following workflow :
Page loads Rooms(or lack of)
click a button to add a room(or
multiples)
ability to search products, and click and drag products
to specific rooms
have all data saved correspondingly in sql
database
What web technologies do I need to research to be able to achieve the above result?
JavaScript/jQuery to handle the front end clicking dragging
PHP (I assume you're already using it) to handle the database queries
PDO - a function in PHP for writing to databases
AJAX - a way of getting data from your JavaScript front end to the PHP backend
Incidentally - you might want to look at InteractJS which is designed to handle the drag and drop your're looking for - you just have to then AJAX the data back to your PHP server for processing.
Good luck!

checking entire database during new post [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 8 years ago.
Improve this question
i have customized cms built in PHP. my website have more than 2,00,000 posts. when i publish a new posts, it take too many time to publish a single posts.
When i publish new post, it is checking entire data base to find if the url is exist in the database. if it exist then it shows an error.
I want to know, is this necessary to check entire database to check, if the url exist already.
Because it is checking entire database before publishing, it takes lot of time and server goes down.
Instead of checking the database to see if the URL is unique, simply force it to be unique by appending the ID of the new record to the URL string that you are saving and configure your website to work like that. For example, instead of you URL looking like:
mywebsite.com/post/test-post
Use something like
mywebsite.com/post/test-post/100
Where the 100 value is the ID of the post, which is a unique Primary Key
If you insist on using a URL that is generated from the subject line of a post (which I suppose is what you're doing here, your question is a bit vague), then create a table that contains hashes of every URL and search for the hash. That's a quick binary search. You'll need to watch out for hash collisions, so you should store the string in full as well.

How to make a bot to navigate a site? [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
Given a product id, associates have to navigate a vendors website, log in, perform a search, in order to get details on a product for a customer.
My employers want a program that can use the product id, and navigate the vendors website, and perform the search and everything to get the information thus saving the associate from having to manually repeat this task every time a customer wants more information about a product.
I know many sites use methods to prevent (CAPTCHA) exactly what I am trying to do. So I do not know if that automatically makes my given project an "evil" one. But I certainly do not have evil intentions, my employers simply want to save associates time on getting information that they are going to get regardless. However, if this is "evil" please explain why, so I can explain to my employers why we should not go down this road. That being said...
How can I make something like this in PHP?
It depends on what site you are trying to access. Many sites have an API that can be used to access data. If that's not the case, you may need to write a program that loads the html using a GET request, parses through the response, and retrieves the information you want. Without more details, that's the best answer I can give.
To start with I'd recommend reading up on cURL and DOM
cURL: http://php.net/curl (for fetching pages, even simulating search form)
DOM: http://www.php.net/manual/en/book.dom.php (to parse the fetched pages)

Categories