Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-01-2006, 07:36 AM
WebProWorld Member
 

Join Date: Aug 2005
Posts: 90
deadhippo RepRank 0
Default php URLEncode question

Hi, I have just set up a t-shirt ranking site. It is a free service but I had intended to add an affiliate code and it would pay for itself that way.
An I had done that or so I thought. I was able to add the affiliate code automatically to the script but I later found that the code was being stripped in the redirect.

The link I am using is as follows...except it is on one line. I broke it up so it wouldn't break up the page.

Code:
 http://theshirtlist.com/cafepress/design_hit.php?
design_id=eccbc87e4b5ce2fe28308fd9f2a7baf3&
design_url=http://www.cafepress.com/deadhippo
/1201429&pid=xxxxxxx&tid=SL1
If you want to check out the link for yourself you can just look at my site - The Shirt List.

I was given the following piece of advice.

Quote:
You haven't URL encoded the design_url value.
You won't be receiving any commission with that link. It's stripping away at the ampersand before pid. So all that gets passed to your redirect script is: http://www.cafepress.com/deadhippo/12014929

It should be formed like this:
http%3A%2F%2Fwww%2Ecafepress%2Ecom%2Fdeadhippo+%2F 1201429%26pid%3Dxxxxxxx%26tid%3DSL1

You use a function called URLEncode to make the link look like that.

Then you need to decode it on your redirect script. Then redirect. And hey presto you redirect with a pid and a tid. No stripping away at the ampersand.
Unfortunately I don't know how to do this. If someone can help me I'd appreciate it.
Reply With Quote
  #2 (permalink)  
Old 10-01-2006, 01:14 PM
stymiee's Avatar
WebProWorld Veteran
 

Join Date: May 2006
Location: New Jersey
Posts: 431
stymiee RepRank 0
Default

PHP has a built in function for this: urlencode()
__________________
John Conde
Brainyminds Merchant Account Services eBook Giant
Reply With Quote
  #3 (permalink)  
Old 10-01-2006, 01:18 PM
WebProWorld Member
 

Join Date: Aug 2005
Posts: 90
deadhippo RepRank 0
Default

Thanks for the reply. If I posted the code here would you be able to show me how to use this function? Unfprtunately I wouldn't even be able to ride on the coattails of a php novice.
Reply With Quote
  #4 (permalink)  
Old 10-01-2006, 08:36 PM
stymiee's Avatar
WebProWorld Veteran
 

Join Date: May 2006
Location: New Jersey
Posts: 431
stymiee RepRank 0
Default

Just put whatever text (or variable holding text) into that function as a parameter. The function will return that text properly encoded for you. But feel free to post your code if you still need help.
__________________
John Conde
Brainyminds Merchant Account Services eBook Giant
Reply With Quote
  #5 (permalink)  
Old 10-02-2006, 10:35 AM
WebProWorld Member
 

Join Date: Aug 2005
Posts: 90
deadhippo RepRank 0
Default

Hi,
Thanks for your reply. This is one part of the code below that I need to urlencode and then decode on the redirect.

Code:
<?
						$order_no = $order_no + 2;
						for($i=0;$i<2;$i++){
							$row_design[design_discription] = nl2br($row_design[design_discription]);
							$row_design[design_image] = "<a href='design_hit.php?design_id=$row_design[design_id]&design_url=$row_design[design_url]$site_pid' target='_blank'>[img]img/design/$row_design[design_image][/img]";
I think the following is what I need to encode.

Code:
$row_design[design_url]$site_pid
The first part part is the item url (i think) and the $site_pid is the affiliate code which is why I'm trying to solve this problem.

Does this help you help me?
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0