clever weblink??

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
josboogz
Forum Newbie
Posts: 12
Joined: Thu Feb 06, 2003 5:05 am

clever weblink??

Post by josboogz »

Hi all,

I currently store a titles of books in one of my mysql tables and was wondering if is possible to ouput the data as a link. But the link would redirect the user to the product page of that book of a bookshop website like amazon or blackwells. So the the title would be automatically entered in the search field of the bookshop website. I would like it to be dynamically done like this since the title of books can change.

Thanks for your time,

José
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Have you examined the format of Amazon's links? For example, do they use a product ID? If so you wouldn't be able to predict what that would be and so you couldn't create dynamic links.

If they used just the book name it might be possible to create a link something like:

$link = '<a href="' . first_part_of_link . $book_name . $last_bit . '">';

..but if your book name doesn't match theirs (forgetting a "the" or an alternative spelling like "color" instead of "colour") the link wouldn't work.

If they have some kind of downloadable book catalogue you could get that, import the data into your mysql database and generate dynamic links with this. If they don't, maybe they'd be amenable to setting it up: wouldn't be hard to do and is useful free marketing for them if lots of sites were to use the data to link to Amazon.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

email them

Post by phpScott »

Why not just emai amazon or however to find out if the have a service that already allows people to do this.
I did a quick search of they're site but didn't find anything obvious.

phpScott
Post Reply