4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 help with buy now code
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
madmick
Junior WebHelper
Junior WebHelper


Joined: 26 Apr 2004
Posts: 7
Location: Uk

PostPosted: Mon Apr 26, 2004 2:28 pm (13 years, 7 months ago) Reply with QuoteBack to Top

On my site I have the current song and last played playlist,could anyone tell me what code I will need to direct listeners to a sales shop eg amazon.
This is part of the code I use
b>1.</b> '.$song[1].'<BR>
<b>2.</b> '.$song[2].'<BR>[need link to buy cd at amazon here]
<b>3.</b> '.$song[3].'<BR>[need link tobuy cd at amazon here]
<b>4.</b> '.$song[4].'<BR>
<b>5.</b> '.$song[5].'<BR>
<b>6.</b> '.$song[6].'<BR>
<b>7.</b> '.$song[7].'<BR>
<b>8.</b> '.$song[8].'<BR>
<b>9.</b> '.$song[9].'</b> <BR></font><BR></Td></table>
</body>

</html>';
Any help appreciated. Smile
OfflineView User's ProfileFind all posts by madmickSend Personal MessageVisit Poster's Website
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Mon Apr 26, 2004 5:21 pm (13 years, 7 months ago) Reply with QuoteBack to Top

Your question is a little vague. I assume, seeing as you've posted in server side coding, you want more than just the HTML for a link. Wink

To link to specific products on Amazon you need to have the ASIN number, this is a unique id number for each product. If your familiar with the Amazon associates program you'll know what I mean.

You don't say where the list of songs are coming from, is it from a database or is it just an array that is defined somewhere? Either way you'll need to associate the aforementioned ASIN number with each song, you can then use that to build a link to Amazon.

give us a bit more info and we'll see if we can help

PS. are you using PHP?
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
madmick
Junior WebHelper
Junior WebHelper


Joined: 26 Apr 2004
Posts: 7
Location: Uk

PostPosted: Mon Apr 26, 2004 6:17 pm (13 years, 7 months ago) Reply with QuoteBack to Top

This is as best I can put it .
On some internet radio stations i see along side of the currently playing an image that says "buy cd" or "buy now" down the way you also have last x amount of songs songs played all with the "buy now"image which links to an URL.
My page is song php which is current song and last 8 played.
What I wish to learn is what code can I use to link any song to any choosen url??? and where would that code be inserted into the song .php many thanks for the reply
<meta http-equiv="refresh" content="60">
<?php

/////////////////////////////////////////shoutcast song status\\\\\\\\\\\\\\\\\\\
// Author: dstjohn (Mediacast1/Casterclub)
// Date started: 05-03-2002 (10:00A.M)
// Date Ended: 05-03-2002 (6:03 P.M)
// Requirements:
// 1.SHOUTcast streaming server
// 2.Oddcast dsp with winamp/xmms (recomended setup)
// 3.Webserver with php 4.x (Recommended environment: Unix (Freebsd, Red Hat etc.. with Apache 3.x)
// Support: None, post in the casterclub forums
// Core script Information:
// SHOUTcast Song Status was written and developed on Windows Xp with apache and php4.1.2
// Has not been tested on IIs webservers, if you do so and get it to work please let us know
// At the forums (http://casterclub.com/forums)
// Also has been tested on freebsd with apache, php4.1.2 and works fine.
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////open connection\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//connect to shoutcast server
include('config.php'); //you may edit this path to fit your server environment otherwise leave it alone
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
if($scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
######################################################################################################################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE");
$y=0;
while($loop[$y]!=''){
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE)
$$scphp = urldecode($$scphp);

// uncomment the next line to see all variables
// echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
######################################################################################################################
######################################################################################################################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while($songatime[$r]!=""){
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);

$r++;
}
//end song info

fclose($scfp);
}

//display stats
if($streamstatus == "1"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>'.$scdef.'</title>
</head>
<center><img src=http://classical-plus.com/carolinejpg.jpg></center>
<body text="white" bgcolor="blue">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Arial" size="2"><b>&nbsp;Stream Bitrate:</b>&nbsp; '.$bitrate.'kbps</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="2" color="white"><b>
<table border=0>
<TD>Current Song:</b> '.$song[0].'</font></p>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="2" color="white">
Past Songs:</font></b></p>
<p style="margin-top: 0; margin-bottom: 0"><font color="white"><font face="Verdana" size="2">
<b>1.</b> '.$song[1].'<BR>
<b>2.</b> '.$song[2].'<BR>
<b>3.</b> '.$song[3].'<BR>
<b>4.</b> '.$song[4].'<BR>
<b>5.</b> '.$song[5].'<BR>
<b>6.</b> '.$song[6].'<BR>
<b>7.</b> '.$song[7].'<BR>
<b>8.</b> '.$song[8].'<BR>
<b>9.</b> '.$song[9].'</b> <BR></font><BR></Td></table>
</body>

</html>';
}
?>
OfflineView User's ProfileFind all posts by madmickSend Personal MessageVisit Poster's Website
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Mon Apr 26, 2004 6:41 pm (13 years, 7 months ago) Reply with QuoteBack to Top

So the track information is coming from an external source or do you have control of it? sorry not familiar with shoutcast

As I said Amazon identifies each product by an ASIN number
e.g. http://www.amazon.co.uk/exec/obidos/ASIN/B00021LPOM/

Unless you can get that piece of information in the same way you are getting the song title I don't think it will be possible, certainly with Amazon. Its not as far as I know possible to link to a specific CD/product by its name - probably the most you could hope for, without the ASIN, would be to have a link that searched amazon for products with the song title.
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
madmick
Junior WebHelper
Junior WebHelper


Joined: 26 Apr 2004
Posts: 7
Location: Uk

PostPosted: Mon Apr 26, 2004 6:56 pm (13 years, 7 months ago) Reply with QuoteBack to Top

Yes I do have an asin no,what I am trying to do is linking in php?
I know if its html
a href=song so n so > amazon asin product id.html</a>

but how do i do it in php code
<b>1.</b> '.$song[1].'<BR> =amazon asin product id.html
perhaps i should give up Crying or Very sad
OfflineView User's ProfileFind all posts by madmickSend Personal MessageVisit Poster's Website
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Tue Apr 27, 2004 7:31 am (13 years, 7 months ago) Reply with QuoteBack to Top

I'll assume you can get the ASIN numbers into an array the same way you did with the song titles, in which case something like this should work:

Code:
<b>1.</b> '.$song[1].' <a href="http://www.amazon.co.uk/exec/obidos/ASIN/'.$asin[1].'/" target="_blank">Buy CD at Amazon</a><br>';


Of course if your going to join Amazon associates the url is slightly different but the principal will be the same.
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.058931 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme