Jump to content

Is there a way to read information on a website


aeroswat

Recommended Posts

Without having permission to access their data? This seems impossible to me without a very huge hassle but is there a way to do this? If so what would I need? Like let's say I wanted to go to a news site and read the weather. Would there be a way to do this without actually getting variables sent from them?

Link to comment
Share on other sites

Yes, it is very possible. Just use the PHP functions to read a file, but instead of a file path use the URL to the page. You will then need to create logic to extract the information you need. How that is done is dependant upon how the site constructs the page. But, if the site ever changes the format of their page your logic will break.

Link to comment
Share on other sites

Technically if you view their website, you are downloading their data for your own use (viewing), so unless the specific part of the website is copyrighted than it, atleast should be ethically acceptable to be able to.

 

The only thing you can really do without them having an API is this:

$sitename = "http://example.com/data.php?page=2";
$contents = file_get_contents($sitename);

preg_match("/<title>([\w\s]*)</title>/i", $contents, $matches); //Match something on the page
$webpage_title = $matches[1];

 

That for example, should download the page and dynamically pull the title tag (thus information) out of it. Just an example.

Link to comment
Share on other sites

Yes, it is very possible. Just use the PHP functions to read a file, but instead of a file path use the URL to the page. You will then need to create logic to extract the information you need. How that is done is dependant upon how the site constructs the page. But, if the site ever changes the format of their page your logic will break.

 

Nice. This sounds very easy to do :) Just have to create unique logic for each individual page! Thanks a lot!

Link to comment
Share on other sites

Before capturing content on their website and displaying on yours. You should contact the ones who you are scraping. Because if they have something like "All rights reserved" you'll be in some trouble when they find out your stole their content.

 

I can be wrong here about something maybe futile but better safe than sorry I say ;)

Link to comment
Share on other sites

Before capturing content on their website and displaying on yours. You should contact the ones who you are scraping. Because if they have something like "All rights reserved" you'll be in some trouble when they find out your stole their content.

 

I can be wrong here about something maybe futile but better safe than sorry I say ;)

 

How about exactly that? a weather report? Say I wanted to say (Such and such news reports the weather as being 68 degrees today) Do you think that would be a big issue? It seems like I could just as easily manually type this in and show people. Doesn't seem like it would be a problem

Link to comment
Share on other sites

Before capturing content on their website and displaying on yours. You should contact the ones who you are scraping. Because if they have something like "All rights reserved" you'll be in some trouble when they find out your stole their content.

 

I can be wrong here about something maybe futile but better safe than sorry I say ;)

 

How about exactly that? a weather report? Say I wanted to say (Such and such news reports the weather as being 68 degrees today) Do you think that would be a big issue? It seems like I could just as easily manually type this in and show people. Doesn't seem like it would be a problem

 

Are you doing your own weather forecasting? If you are using the content from another site you need to get permissions and, possibly, give credit. I have to believe there is some free service available to get current weather info. I'm sure you can find something with a little work.

Link to comment
Share on other sites

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.