May 4, 2011

Adding Cookie to $link | CyberSEO Pro | Support Forum

Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_TopicIcon
Adding Cookie to $link
Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 Topic Rating: 0 (0 votes) 
February 29, 2016
1:02 pm
Avatar
muttley1
Member
Members
Forum Posts: 7
Member Since:
February 29, 2016
sp_UserOfflineSmall Offline

I’ve set up a cookie on my site and I want to retrieve it so I can add it to my gallery URL’s..

For example..

I want to change this…

Login to see the code

to this…

Login to see the code

Is this possible to do?

The cookie is called ‘ref’ and is working. I know there are GET & Echo type functions but I don’t really know how to apply them here.

(I’ve tried a few things but keep getting errors because I am probably using the wrong syntax and I am a complete beginner at PHP!)

March 1, 2016
6:50 am
Avatar
CyberSEO
Admin
Forum Posts: 3636
Member Since:
July 2, 2009
sp_UserOfflineSmall Offline

Login to see the code

March 1, 2016
7:17 am
Avatar
muttley1
Member
Members
Forum Posts: 7
Member Since:
February 29, 2016
sp_UserOfflineSmall Offline

Thanks for your quick response!

So to insert the cookie value (ref), would this work? 

(my syntax is probably wrong!)

$link = str_replace(“http://url.com/track/”, “http://url.com/track/”. $_COOKIE[‘ref’], $link);

(sorry I can’t figure out how to post the text as code)

March 1, 2016
8:06 am
Avatar
CyberSEO
Admin
Forum Posts: 3636
Member Since:
July 2, 2009
sp_UserOfflineSmall Offline

I don’t know how your script sets a cookie. If it needs “http://url.com/track/cookie value” – it will work. If not, it won’t.

March 1, 2016
11:58 am
Avatar
muttley1
Member
Members
Forum Posts: 7
Member Since:
February 29, 2016
sp_UserOfflineSmall Offline

I’ve set the cookie by adding some PHP code on the home page of the site. It is a URL parameter (ref) that is cookied…

For example…   Login to see this link …. 

‘ref’ actually corresponds to affiliate ID’s and I can successfully echo ‘ref’ into a banner on the site so I know the cookie is set ok .

I can’t get this to work with my CyberSEO generated content because I think that CyberSEO is processing the $link first and the link becomes set in stone.. so if I then generate a new URL and that creates a new cookie, it can’t be added to the link.

I hope that makes sense :)

I understand if this is not possible. I may be trying to do something unrealistic

March 2, 2016
3:42 am
Avatar
CyberSEO
Admin
Forum Posts: 3636
Member Since:
July 2, 2009
sp_UserOfflineSmall Offline

Sorry, but I still don’t understand what exactly you are trying to do. There is nothing impossible for CyberSEO, but I have to know what exactly you want to do. If you want to order a custom coding, please contact me by email.

March 2, 2016
8:41 am
Avatar
muttley1
Member
Members
Forum Posts: 7
Member Since:
February 29, 2016
sp_UserOfflineSmall Offline

Ok cool, sorry for not explaining it very well :)

I’ve managed to figure it out in a round about way so its all good now :)

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 541

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

ninja321: 84

s.baryshev.aoasp: 64

Freedom: 61

MediFormatica: 49

B8europe: 47

saviulisse67: 45

Member Stats:

Guest Posters: 338

Members: 2602

Moderators: 0

Admins: 1

Forum Stats:

Groups: 1

Forums: 4

Topics: 1519

Posts: 7668

Newest Members:

frederic.jezegou, test.test, david_alija, paypal.orasmarketing, brad.lee.coates, Thatcham Town Radio

Administrators: CyberSEO: 3636