[advanced search]
Results from the most recent live auction are here.
22 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Domain Name Industry Newsletter
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 01-09-2007, 05:27 PM   · #1
Alex.
NamePros Regular
 
Alex.'s Avatar
 
Name: Alex
Location: Uk
Trader Rating: (7)
Join Date: Nov 2006
Posts: 601
NP$: 133.80 (Donate)
Alex. is on a distinguished road
Ethan Allen Fund Third World Education
[php] passing variables to different sites

hi, i want to send a variable to a site i link to.

i cannot use a form, the script has to send the var without any user input.

ie, when i click an affilate link on my site, it redirects to a page on the site, which sends the var onto the next site.

using get is a last resort, because ideally i dont want the user to see the var.


Please register or log-in into NamePros to hide ads
__________________
Alex. is offline   Reply With Quote
Old 01-09-2007, 08:06 PM   · #2
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,801
NP$: 54.00 (Donate)
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
Autism Autism Autism Autism Autism Autism Autism
I think you are going to have to pass the variable with get unless you want to make some JS script that creates a form, the action, the inputs, and submits it..
Dan is offline   Reply With Quote
Old 01-09-2007, 08:33 PM   · #3
baxter
NamePros Regular
 
baxter's Avatar
 
Trader Rating: (11)
Join Date: Apr 2006
Posts: 278
NP$: 2050.00 (Donate)
baxter is a jewel in the roughbaxter is a jewel in the roughbaxter is a jewel in the rough
Ethan Allen Fund Save The Children
you could use CURL to pass the variable via POST data.

@link http://ca.php.net/curl
__________________
Chimps.ca - Swans.ca - Snails.ca
baxter is offline   Reply With Quote
Old 01-09-2007, 08:41 PM   · #4
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,801
NP$: 54.00 (Donate)
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
Autism Autism Autism Autism Autism Autism Autism
CURL wouldn't go to their URL though.. I think that's what he needs. If not, CURL would work good. http://www.namepros.com/code/257265-curl-class.html
Dan is offline   Reply With Quote
Old 01-10-2007, 12:41 AM   · #5
plong0
New Member
 
Trader Rating: (0)
Join Date: Jan 2007
Posts: 8
NP$: 0.00 (Donate)
plong0 is an unknown quantity at this point
here's code for two ways...

without using GET, you can do with a simple form and JS event to submit...
Code:
<form id="mysecretform" method="POST" action="http://link.to/passvar.to"> <input type="hidden" name="mysecretvar" value="itsasecret" /> </form> <a href="#" onclick="document.getElementById('mysecretform').submit();">Method 1</a>


And like Dan said, you can make it all in a JS function to do it all so it's all reusable and such...
within <head> section...
Code:
<script type="text/javascript"> function sendSecret(myVar, myVal, target) { hiddenVal = document.createElement("input"); hiddenVal.type = "hidden"; hiddenVal.name = myVar; hiddenVal.value = myVal; myForm = document.createElement("form"); myForm.method = "POST"; myForm.action = target; myForm.appendChild(hiddenVal); document.body.appendChild(myForm); myForm.submit(); } </script>


and on the link...
Code:
<a href="#" onclick="sendSecret('mysecretvar', 'itsasecret', 'http://link.to/passvar.to');">Method 2</a>


I tested them on FireFox, it should work on all browsers though

Last edited by plong0 : 01-10-2007 at 12:46 AM.
plong0 is offline   Reply With Quote
Old 01-10-2007, 12:43 AM   · #6
beaver6813
NamePros Regular
 
beaver6813's Avatar
 
Name: Sam Cleaver
Location: England
Trader Rating: (11)
Join Date: May 2005
Posts: 346
NP$: 59.50 (Donate)
beaver6813 is a jewel in the roughbeaver6813 is a jewel in the roughbeaver6813 is a jewel in the rough
From what your saying... do you mean just using GET?
Quote:
ie, when i click an affilate link on my site, it redirects to a page on the site, which sends the var onto the next site.



You could just use get and obfuscate the variables by encoding the values. Just set link to something like mypage.php?var1=lol&var2=whatever&etc=etc
__________________
-Beaver6813.com V5 Soon!
beaver6813 is offline   Reply With Quote
Old 01-10-2007, 04:36 AM   · #7
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,801
NP$: 54.00 (Donate)
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
Autism Autism Autism Autism Autism Autism Autism
Originally Posted by manofgames
using get is a last resort, because ideally i dont want the user to see the var.





Try plong0's code.
Dan is offline   Reply With Quote
Old 01-10-2007, 05:42 AM   · #8
Alex.
NamePros Regular
 
Alex.'s Avatar
 
Name: Alex
Location: Uk
Trader Rating: (7)
Join Date: Nov 2006
Posts: 601
NP$: 133.80 (Donate)
Alex. is on a distinguished road
Ethan Allen Fund Third World Education
thanks for your help.
i think the simplest way for me to do it is encode the var and sand it via get.

problem resolved
__________________
Alex. is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

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
Forum Jump


Site Sponsors
Proof is in the Parking Proof is in the Parking Hunting Moon
Advertise your business at NamePros
All times are GMT -7. The time now is 10:42 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0