NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Help Needed (String Manipulation) 100 NB Awarded

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 09-03-2004, 11:08 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
DomainSpring's Avatar
Join Date: Aug 2003
Location: NJ, USA
Posts: 286
DomainSpring is on a distinguished road
 



Cool PHP Help Needed (String Manipulation) 100 $NB Awarded


Hi,

Can someone please help me with some PHP string manipulation? I will award 100 NameBucks to the first person who sends me quality code that works correctly (post "DONE" and PM me the code). Basically, I will be passing in a random URL, and if it is from eBay or amazon.com, the string/URL needs to be changed to include referral code. The eBay one should be easier:

For example:

Code:
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=11153&item=5718385022
changes to (there should be no spaces after "item"):

Code:
http://www.qksrv.net/click-1549868-5463217?loc=http%3A//cgi.ebay.com/ws/eBayISAPI.dll%3FViewItem%26category%3D11153%26item%3D5718385022
Another example:

Code:
http://search.ebay.com/_W0QQtZvb?ssPageName=h:h:fitem:US
changes to:

Code:
http://www.qksrv.net/click-1549868-5463217?loc=http%3A//search.ebay.com/_W0QQtZvb%3FssPageName%3Dh%3Ah%3Afitem%3AUS
So, basically, it looks like you will have to check that "ebay.com" is in the string/URL, and if so, take the whole string/URL, URLencode it, and append it after "http://www.qksrv.net/click-1549868-5463217?loc="
????: NamePros.com http://www.namepros.com/programming/46289-php-help-needed-string-manipulation-100-a.html

Amazon examples:

Code:
http://www.amazon.com/exec/obidos/tg/detail/-/B00019PD0W/qid=1094262263/sr=8-1/ref=pd_ka_1/002-2456420-8213624?v=glance&s=music&n=507846
changes to:

Code:
http://www.amazon.com/exec/obidos/redirect?tag=domainspring-20&path=tg/detail/-/B00019PD0W/qid%3D1094262263/sr%3D8-1
"tag=domainspring-20" in the above code is my referral code.

However, a URL like:
????: NamePros.com http://www.namepros.com/showthread.php?t=46289

Code:
http://www.amazon.com/exec/obidos/ASIN/B0000X5RTG/domainspring-20
should be left alone (I will go ahead and say anything with "/ASIN/")

Of course, for both of these sites, it's important that no URLs that already have a referral code already (like the example above) get modified (probably into something messy). Confused much? PM me with any questions or if you need more examples - perhaps someone that has Amazon Associates experience can let me know of any other potential snafus.

Thanks!
Cary
Last edited by DomainSpring; 09-04-2004 at 01:28 AM.
DomainSpring is offline  
Old 09-04-2004, 02:00 AM   #2 (permalink)
NamePros Regular
Join Date: Jun 2003
Location: .au/.sg
Posts: 221
alien is on a distinguished road
 



Don't need NameBucks. Try this (You might have to modify the amazon match string if you have different amazon urls.) :

PHP Code:
PM sent 
????: NamePros.com http://www.namepros.com/showthread.php?t=46289
E.g.: echo changed("http://www.amazon.com/exec/obidos/tg/detail/-/B00019PD0W/qid=1094262263/sr=8-1/ref=pd_ka_1/002-2456420-8213624?v=glance&s=music&n=507846");
__________________
@

PageRank.net - Search Engine Optimization
Last edited by alien; 09-05-2004 at 07:35 PM.
alien is offline  
Old 09-04-2004, 02:20 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
DomainSpring's Avatar
Join Date: Aug 2003
Location: NJ, USA
Posts: 286
DomainSpring is on a distinguished road
 



Thanks for getting back to me alien Can you just add something that checks for "amazon.com" instead of just checking for the "tg" and "/ref" (I believe that is what the code checks). I'll be happy to send you the $100NB as promised.
Last edited by DomainSpring; 09-05-2004 at 07:44 PM.
DomainSpring is offline  
Old 09-04-2004, 11:07 PM   #4 (permalink)
NamePros Regular
Join Date: Jun 2003
Location: .au/.sg
Posts: 221
alien is on a distinguished road
 



__________________
@

PageRank.net - Search Engine Optimization
Last edited by alien; 09-05-2004 at 07:36 PM.
alien is offline  
Old 09-05-2004, 12:41 AM THREAD STARTER               #5 (permalink)
NamePros Regular
 
DomainSpring's Avatar
Join Date: Aug 2003
Location: NJ, USA
Posts: 286
DomainSpring is on a distinguished road
 



Hi,

Yes, I was eluding to the top version, with the combined solution (although that code seems to only return $am). If you can figure out what is wrong with that, I'd appreciate it. I am sending over the $NB now. Thanks for your efforts and kindness

Cary
Last edited by DomainSpring; 09-05-2004 at 07:44 PM.
DomainSpring is offline  
Old 09-05-2004, 01:46 AM   #6 (permalink)
NamePros Regular
Join Date: Jun 2003
Location: .au/.sg
Posts: 221
alien is on a distinguished road
 



__________________
@

PageRank.net - Search Engine Optimization
Last edited by alien; 09-05-2004 at 07:37 PM.
alien is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:22 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger