I have 2 websites:
website A which is blank and is categorized;
website B which doesn't have categories but has information;

I want php to go to website B, get all the new information that has been added since last visit, and then update websites A database;
now i know basic php but this seems to be out-of-scope so to say :D

so now the question: how to make php go to website B and read all the info? not asking for code, im just wondering under what title could i find the information;
and also, in the php-beginners-difficulty-scale 1 to 10, how hard would it be to accomplish this?
any general advice?

Recommended Answers

All 5 Replies

Depends a bit on how you can retrieve the data from site B. If there are webservices/soap you can use, or perhaps a rss feed. Otherwise there's always curl.

Are they both database driven, and do you have access to both databases?

Depends a bit on how you can retrieve the data from site B. If there are webservices/soap you can use, or perhaps a rss feed. Otherwise there's always curl.

the way i was planning to do it was by reading source, so curl it would be. however now that you mentioned, there indeed are rss feeds and iv got a feeling it would be much easier doing through them as it'd be less cluttered.
what would be the way to get info from there? curl as well?

Are they both database driven, and do you have access to both databases?

yes they are both database driven, however i only have access to website A;

now that i started doing i have some questions:
*lets say i extracted the information i needed from website B, filtered it and put it into website A, category C1, page1;
page 1 of C1 starts to fill up. how to make it, so that when its full, all the contents of page 1 are moved to page 2, when it again is full, contents move by 1 more page (page 1 > page 2 > page3) etc. ;
*can php run scripts automatically at a certain time in day, everyday?

If the information that you want is available in an rss feed, then i think that is the way to go. If the info you want to scrape is not available to you in the rss feed(s) then you will have to grab the source and extract the parts you want.

I think what you're describing as pages, is better described as pagination, which would follow the general concept of:

On page 1 display the last 10 updates. If the number of updates exceeds 10, then divide the total number of updates by ten and round up (floor()) that number is the total number of pages. You would do some basic math and determine what page the user is on and what records to retrieve in the query, first 10, second 10 etc, using LIMIT. There are lots of great tutorials on how pagination works and its intricacies.

This can be done with php and some logic without the need to automate it to generate static files.

pagination is indeed what i wanted, will look through;
found cron to solve the problem of updating website A automatically;
now ill need some time to write the code. thx for the help so far

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.