473,396 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using external web sites search form to query database

Hey guys! Did you miss me? I sure missed you ;). Finished my course today! The next one will begin the coming week so I will have some time to try some stuff out. Because this is my first post in a very long time I would say that it should technically be viewed as a first post. So without further ado…

This is my first post, please be gentle.

I want to use PHP to

1) do a search

2) choose some of the result (open them)

3) save the content.

The third step isn’t a problem.

Regarding the first step: I know that I could use the URI string to query a database with the search terms, however it would be much easier if I could just use the actual form and type my key strings. Why so? Because some pages are stupid and I can’t understand how they are querying the database (I think it's because they use POST).

Any ideas how I could approach this problem?

Regarding the second step: for the moment I can’t seem to find any problems; the search result renders links and all I need to do is to identify the suckers – sounds like a job for REGEX!

To recap: how can I search a web sites database using the web sites own search function [i.e. the search form]?
Oct 19 '07 #1
4 3216
Atli
5,058 Expert 4TB
To recap: how can I search a web sites database using the web sites own search function [i.e. the search form]?
Hi. Welcome back! :)

I'm not sure I fully understand what you are asking.
What is "the web sites own search function"?
Is this a part of some web you created?

It is easy enough to create a <form> element and use it's <input> to search a database, but I am not sure that's what you are asking for.
Oct 20 '07 #2
Hi. Welcome back! :)

I'm not sure I fully understand what you are asking.
What is "the web sites own search function"?
Is this a part of some web you created?

It is easy enough to create a <form> element and use it's <input> to search a database, but I am not sure that's what you are asking for.
Hey! Thanks for your reply!

Ok, let's see if I can do this right:

Basically what I want to do is to download content from another web site. The content, however, is not the "actual web site" but the database entries it holds (e.g. a Wikipedia article, or maybe a Google search result).

Let's say that the web site is Google, and I want to get the top ten search results for "the Scripts" ;), then I could use something like
http://www.google.com/search?source=...=Google+Search

That would create a html page with the results. I could then filter out what I want (e.g. the links to each result).*

*I haven't actually tried this, but I see no reason why it shouldn't work.

Now my problem: it would seem is that not all web sites use GET (to request the database), so I can't use the URI string to define my search terms; all I'm stuck with is the actual search form (the one you see when you are browsing, i.e. the rendered HTML-form).

In other words: I want to search a external website database, and the only access to that database is -- as far as I can see it -- through that websites [rendered] search form.

The only thing that comes through my mind is that I
1) open the external website in PHP and
2) jump the cursor to the form / or activate the form
3) have a list of search terms PHP uses to write in the input box and then
4) "presses the search button" so that the search is executed.

This however sounds more like a job for macros... No?

I'm out of [good] fresh ideas...
Oct 20 '07 #3
pbmods
5,821 Expert 4TB
Heya, ManWithNoName.

You can send POST data using cURL or (sometimes) HTTP stream contexts.

I posted a short example of how to use cURL around here somewhere....

Ah. Here it is.
Oct 21 '07 #4
I knew that you would eventually come to my rescue ;) It seems to be what I was looking for! Thanks! You’re the man pbmods! :D

Now I have some more information/functions/terms to work with! =D And now I have some more stuff to think about when sitting through my course until the winter holidays ;)
Oct 21 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Kate Perry | last post by:
I am trying to execute a query on a db2 database using the dbi module. I'm wondering if someone can take a look at my code and tell me what I'm doing wrong. I'm assuming it's a problem with my...
1
by: Joris Kempen | last post by:
Hi people, I know that the question has come around sometimes: How to open an Access Report using ASP and export it to for example RTF. I'm trying to implement the first method of David...
6
by: ats | last post by:
I have a table that contains the database names of external databases. Each one of these external databases contain a table (which has the same structure) that I would like to query together as one...
4
by: kcopson | last post by:
I need a routine to add a new field to an existing table in a database that is in another town. Situation: I maintain a database with 10 copies in different offices. Everytime we want to make a...
3
by: WiseG1rly | last post by:
Hey everyone! I am completley new and I will start off by saying that I am not a programmer - figuring out this search took so long! I am debugging now and would appreciate any help :) ...
1
by: jcf378 | last post by:
Hi all-- Does anyone have any insight as to how I might create a search form that allows a user to select criteria based on any related table in the whole database. The search form I have now only...
5
by: agarwalsrushti | last post by:
hi, This is my the search code i have tried it works well with the fiels stores as string in the database. But i have stored the qualification and specialization as int in database. Each selected...
13
by: Robertf987 | last post by:
Hi, Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000. What I want is to be able to do a...
1
by: mfaisalwarraich | last post by:
Hi Everybody, I have an external database called Patients.mdb where i made a query called qryAdmissionDetails. now i want to run this query on a report of another database called...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.