Jump to content

Recommended Posts

Hi everyone. Just signed up :)

 

Anyway, i have some basic knowledge of php; i am able to create basic working scripts etc., but nothing too extensive.

 

Im thinking about starting a project, but before doing so, id like to extract some information from a database that is publically available from a certain website, so that i can re-organize the data into a way that will be most useful to me. The data i extract will not be for commercial use, so the method does not necessarily need to be the most efficient method. Is anybody able to suggest a function or class that i should perhaps look into that can do this type of thing?

 

Thanks in advance. Sorry if i have not explained myself clearly enough.

 

Dan.

You should use the PHP's CURL functions (provided that you have CURL set up) to retrieve the information you're looking for.  Then use preg_match or preg_match_all to extract the information from the retrieved pages.  Here are some links for this:

 

CURL - http://www.php.net/curl

 

preg_match - http://www.php.net/preg_match

another good place to start be would be with the question ...

 

what kind of database is it?

 

or is it just web pages with information on it?

 

if the latter is true .. you will really need to learn how to use preg_match very well. Even then, it might not be possible to get everything out exactly the way you want it.

 

 

used in conjunction with the above if its a JSOn or XML file or HTML or any text

<?php
$handle = fopen("http://www.example.com/", "rb");
$contents = '';
while (!feof($handle)) {
  $contents .= fread($handle, 8192);
}
fclose($handle);
?>

Thanks for the help guys.

 

To answer your question severndigital, it is just a website displaying the information.

 

I managed to write up a script that does exactly what i need. The regular expressions for the preg match all function werent too hard to write since the extractions were fairly easy to do :)

 

Thanks again,

Dan.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.