Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > How can I send variables from a PHP script to another URL using POST without.........

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-27-04, 06:24
laxy_m laxy_m is offline
Registered User
 
Join Date: Sep 2004
Posts: 4
How can I send variables from a PHP script to another URL using POST without.........

hello!!
Every one How can I send variables from a PHP script to another URL using POST without using forms and hidden variables?

Thanks
Laxy
www.funspot.com
Reply With Quote
  #2 (permalink)  
Old 09-27-04, 07:54
rajesh_r_r rajesh_r_r is offline
Registered User
 
Join Date: Jan 2004
Location: India
Posts: 168
I think you shoud make use of sessions. This can be used for this kind. Make a sessionid and declare some session variables in that then pass the session variables through the url.
This one of he method I would do

Regards
Rajesh
Reply With Quote
  #3 (permalink)  
Old 09-27-04, 21:49
pebkac pebkac is offline
Registered User
 
Join Date: Jan 2004
Posts: 35
you could aways send them in a link possibly. for example:

<a href="/links/mylink.php?passvalue=2&anothervalue=yes"> Link </a>

Then you will have 2 values you can retireve. Kinda a round about way, but not complely sure on your complete objective.
Reply With Quote
  #4 (permalink)  
Old 09-28-04, 07:58
rajesh_r_r rajesh_r_r is offline
Registered User
 
Join Date: Jan 2004
Location: India
Posts: 168
It hink you need the post method b'coz you don't want the users to see the variables and the values on the url.
Then you have only one choise that would be sessions.

regards
Rajesh
Reply With Quote
  #5 (permalink)  
Old 10-20-04, 19:57
Tylmail.com Tylmail.com is offline
Registered User
 
Join Date: Oct 2004
Location: Manchester, UK.
Posts: 3
To Pass Variables without Hidden Form Fields

You can open an HTTP socket connection and send HTTP POST commands. Here is
an example :

PHP Code:
<?php
// Generate the request header 
$ReqHeader 
"POST $URI HTTP/1.1\n"
"Host: $Host\n"
"Content-Type: application/x-www-form-urlencoded\n"
"Content-Length: $ContentLength\n\n"
"$ReqBody\n"

// Open the connection to the host 
$socket fsockopen($Host80, &$errno, &$errstr); 
if (!
$socket

$Result["errno"] = $errno
$Result["errstr"] = $errstr
return 
$Result

$idx 0
fputs($socket$ReqHeader); 
while (!
feof($socket)) 

$Result[$idx++] = fgets($socket128); 

//------------------------------------------- 
?>


Or you can use the cURL extensions for PHP (http://curl.haxx.se). Once you build it and compile their support into PHP, it is fairly easy to do posting stuff (even over https):


PHP Code:
<?php 
$URL
="www.mysite.com/test.php"
$ch curl_init();    
curl_setopt($chCURLOPT_URL,"https://$URL"); 
curl_setopt($chCURLOPT_POST1); 
curl_setopt($chCURLOPT_POSTFIELDS"Data1=blah&Data2=blah");curl_exec ($ch);     
curl_close ($ch); 
?>


This will have the net effect of posting your data to the $URL site, without any header hacking.

You can also do other nifty things with cURL, like retrieve the HTML into variables and scrape through it for neat functionality.

To use cURL you need to recompile PHP or check with your Host to see if they support it (http://www.tylmail.com does)

Taken From: http://www.alt-php-faq.org/local/55/#id55

Last edited by Tylmail.com : 10-21-04 at 07:26.
Reply With Quote
  #6 (permalink)  
Old 10-27-04, 08:19
laxy_m laxy_m is offline
Registered User
 
Join Date: Sep 2004
Posts: 4
Post thank you for reply

thank you for reply

Laxy
Trampoline
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On