Search using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
omidkamangar
Forum Newbie
Posts: 16
Joined: Sun Jul 30, 2006 2:51 pm

Search using PHP

Post by omidkamangar »

Hi,
This is my problem:
I have a web server which runs with a PHP script on it. This script is used to search a database for a given number. I want to write another script which has a form inside it, and users can search for multiple numbers.
I mean there are several text boxes in it and the user enters numbers, my script should send this numbers to the search script one by one and collect the resulting pages. I donot have access to the PHP search script source, because it has been written by a company which refuses to give me the source.
How can I do it? Can you help?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Are you sure you have authorization to scrape data from that server?

What you will probably have to do is scrape the pages yourself using CURL, parse out the data, and serve them back to user. If they have an XML-RPC or SOAP interface, it makes things a bit easier, but either way it will be sloooow.
smudge
Forum Contributor
Posts: 151
Joined: Sun May 20, 2007 12:13 pm

Post by smudge »

Ok, i think i know what you mean. First, it would be good to know what kind of interface you have w/ the remote script. Do you give it a number by including the script, then using a function, or by POST/GET, SOAP, etc? If you send it numbers by GET, i think a good way to start would be something like:

Code: Select all

foreach($_GET['numberboxes'] as $number){
  echo include("http://wherever.com/script.php?num=$number");
  echo "<hr>";
}
that is, assuming textboxes are:

Code: Select all

<input type='text' name="numberboxes['num1']" />
I don't do much with SOAP, so i wouldn't know what to do in that case.
Another option is client-side AJAX, making a single new request for each number in the field.

Hope I could help!
Post Reply