update from another website

05-30-08, 04:52 AM
|
|
Newbie Coder
|
|
Join Date: May 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
update from another website
Hi There
>
> I am looking for a script which will enable me to do the following on
a review site!
> For example I am reviewing a product lets call it a nokia cellphone.
> But I have signed up with 5 companies as their affiliate. I write a
product review for it and then tell the customer it is available from
the following stores. Now next to each of the stores name I should put a
price. But I want that price to be linked automatically to my site so
for example if they changed their price it will change on my web site as
well! So that my content is always up to date!
|

05-30-08, 08:31 AM
|
 |
Community VIP
|
|
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
|
|
Unless the websites that have the prices have RSS feed, you are going to have to do CURL and some preg matching. Do you have a sample site I could take a look at? You can PM it to me if you don't want to post it here.
Pete
|

05-30-08, 09:12 AM
|
 |
Coding Addict
|
|
Join Date: Jul 2007
Location: Clayton, NC
Posts: 292
Thanks: 0
Thanked 1 Time in 1 Post
|
|
You'd need a good API that linked his site url's to the affiliate's pricing. You may want to see if the affilates offer an API service. cURL? I'm not sure I follow you there. It's a command line for protocol transfer. URL syntax, different protocols, scraping, etc.
|

05-30-08, 09:28 AM
|
 |
Community VIP
|
|
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
|
|
Quote:
Originally Posted by Boraan
You'd need a good API that linked his site url's to the affiliate's pricing. You may want to see if the affilates offer an API service. cURL? I'm not sure I follow you there. It's a command line for protocol transfer. URL syntax, different protocols, scraping, etc.
|
Definition of CURL according to PHP Website:
Quote:
|
PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.
|
Pete
|

05-30-08, 11:47 AM
|
 |
Coding Addict
|
|
Join Date: Jul 2007
Location: Clayton, NC
Posts: 292
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Exactly, it's command-line based for protocal transfer. It facilitates the connection between different protocols. I still don't see how you would use it to sync data from one server to another. You need an API to do that.
Edit: I'm not putting you down, I was looking for an explaination. I know what it does, but maybe you have an application for cURL that I never used.
|

05-30-08, 12:22 PM
|
 |
Community VIP
|
|
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
|
|
Quote:
Originally Posted by Boraan
Exactly, it's command-line based for protocal transfer. It facilitates the connection between different protocols. I still don't see how you would use it to sync data from one server to another. You need an API to do that.
Edit: I'm not putting you down, I was looking for an explaination. I know what it does, but maybe you have an application for cURL that I never used.
|
You could either:
1. Retrieve prices on the fly:
If you do it this way, when the visitor requests the page on your local server you would: - Use CURL to retrieve / read HTML page content from remote website.
- Use pregmatch to pinpoint price on remote server.
- If price has changed, update the new price in your local database.
- Display updated price to user.
2. Schedule a crontab to update prices nightly:
Same as above, except you could schedule a cron job to do ALL the price updating for you on a nightly basis. This is a better idea I think, because of lower bandwidth usage and faster page load for user during the day.
Pete
|

05-30-08, 05:29 PM
|
 |
Junior Code Guru
|
|
Join Date: May 2006
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Boraan
Exactly, it's command-line based for protocal transfer. It facilitates the connection between different protocols. I still don't see how you would use it to sync data from one server to another. You need an API to do that.
Edit: I'm not putting you down, I was looking for an explaination. I know what it does, but maybe you have an application for cURL that I never used.
|
Huh? I use cURL everyday to update parts of my NCAA site!
What do you mean, command-line based? Should I whip up a php script to demonstrate what he is talking about... C'mon man, really..... cURL (php) is almost the same as LWP...
__________________
Whatever you decide, you should make sure best security methods are used and practiced. Should you really need more help, PM me.
Last edited by Christian; 05-30-08 at 09:26 PM.
Reason: removing link
|

05-30-08, 08:35 PM
|
 |
Coding Addict
|
|
Join Date: Jul 2007
Location: Clayton, NC
Posts: 292
Thanks: 0
Thanked 1 Time in 1 Post
|
|
ok. You all are misunderstanding me. Let me clarify. cURL just facilitates the connection, not the actual transfer. Maybe I should put it this way. cURL facilitates the connection, what is actually doing the data transfer? Are you writing the API in PhP? I use cURL (the command line utility) to maintain cross protocol connections. You've got to have and API to do the transfer. Quite literally, cURL is the wrapper and it wraps the API. cURL has an API called libcurl. When you all said use cURL you're referring to the tool... My question is, what are you using for the API.
cURL is the wrapper. The API does the transfer. If you're using cURL with PHP, what are you using for the API.
http://en.wikipedia.org/wiki/CURL
"cURL is a command line tool for transferring files with URL syntax."
"Libcurl is the corresponding library/API"
If you've just got cURL... what is your API? 'Cause referring to cURL is referring to the command line utility.
|

05-31-08, 12:07 AM
|
 |
Community VIP
|
|
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
|
|
Ok Boraan ... I am going to stop arguing about this, because its not benefiting the person who started this thread. I would appreciate if you did the same.
Pete
|

05-31-08, 10:39 AM
|
|
Newbie Coder
|
|
Join Date: Jun 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
If you wish to go it, scrape the pages daily and update the prices in your database. Try this tutorial, http://www.oooff.com/php-scripts/bas...ta-parsing.php, then create your script, add mysql to it, insert the prices to the database and using a cron job get it to update the database daily. Simple.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|