Re: [PHP] $HTTP_POST array

2004-12-28 Thread Zareef Ahmed
Hi Kalinga,

it is not recomended to use $HTTP_POST_VAR array. Use $_POST and 
it have global scope. In PHP5, we have a special directive by which we
can disable $HTTP_*_VAR. currently it defaults to enabled. But who
says in future versions of PHP it default set to disabled. then your
code will not run. So Use $_POST, $_GET etc. instead of using old long
$HTTP_*_* style.


zareef ahmed 


On Mon, 27 Dec 2004 18:31:21 +0300, Burhan Khalid [EMAIL PROTECTED] wrote:
 kalinga wrote:
  Dear all,
  Is it possible to pass the entire $HTTP_POST array to a function of a class
  as a variable?
 
 Use $_POST -- its automatically in scope of every function (you don't
 need to pass it).
 
 You can pass any array to a function.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $HTTP_POST array

2004-12-27 Thread Burhan Khalid
kalinga wrote:
Dear all,
Is it possible to pass the entire $HTTP_POST array to a function of a class
as a variable?
Use $_POST -- its automatically in scope of every function (you don't 
need to pass it).

You can pass any array to a function.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] $HTTP_POST array

2004-12-23 Thread kalinga
Dear all,
Is it possible to pass the entire $HTTP_POST array to a function of a class
as a variable?

without doing ...

 $new_classAccount = new classAccount;
 $msg = 
$new_classAccount-addAccount($HTTP_POST_VARS['accountName'],$HTTP_POST_VARS['firstName'],$HTTP_POST_VARS['lastName']);

is it possible to..
 $new_classAccount = new classAccount;
 $msg = $new_classAccount-addAccount($HTTP_POST);

i googled a lot on this but did not find any good code sample.

hope somebody can gide me on this.

-- 
vk.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] $HTTP_POST array

2004-12-23 Thread Jason Wong
On Thursday 23 December 2004 16:46, kalinga wrote:

 Is it possible to pass the entire $HTTP_POST array to a function of a class
 as a variable?

It is possible to pass *any* array to a function of a class as a variable.

 without doing ...

  $new_classAccount = new classAccount;
  $msg =
 $new_classAccount-addAccount($HTTP_POST_VARS['accountName'],$HTTP_POST_VAR
S['firstName'],$HTTP_POST_VARS['lastName']);

 is it possible to..
  $new_classAccount = new classAccount;
  $msg = $new_classAccount-addAccount($HTTP_POST);

 i googled a lot on this but did not find any good code sample.

Well the syntax you have looks OK, did you try it? Perhaps you meant to pass 
$HTTP_POST_VARS?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Cinemuck, n.:
 The combination of popcorn, soda, and melted chocolate which
 covers the floors of movie theaters.
 m  -- Rich Hall, Sniglets
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] HTTP_POST Intermittent Problem

2004-08-26 Thread Jeff Oien
I'm using the code below and about a third of the posts aren't getting 
through. We have no idea why and don't know where to start to trouble 
shoot. Any ideas? Thanks.
Jeff

function http_post($host, $path, $data)
{
 $http_response = '';
 $content_length = strlen($data);
 $fp = fsockopen($host, 80);
 fputs($fp, POST $path HTTP/1.1\r\n);
 fputs($fp, Host: $host\r\n);
 fputs($fp, Content-Type: application/x-www-form-urlencoded\r\n);
 fputs($fp, Content-Length: $content_length\r\n);
 fputs($fp, Connection: close\r\n\r\n);
 fputs($fp, $data);
 while (!feof($fp))
 {
  $http_response .= fgets($fp, 128);
 }
 fclose($fp);
 return $http_response;
}
$http_response = http_post('www.blah.com', '/test.aspx?', 'data');
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HTTP_POST Intermittent Problem

2004-08-26 Thread Matt M.
 function http_post($host, $path, $data)
 {
   $http_response = '';
   $content_length = strlen($data);
 
   $fp = fsockopen($host, 80);
   fputs($fp, POST $path HTTP/1.1\r\n);
   fputs($fp, Host: $host\r\n);
   fputs($fp, Content-Type: application/x-www-form-urlencoded\r\n);
   fputs($fp, Content-Length: $content_length\r\n);
   fputs($fp, Connection: close\r\n\r\n);
   fputs($fp, $data);
   while (!feof($fp))
   {
$http_response .= fgets($fp, 128);
   }
   fclose($fp);
 
   return $http_response;
 }
 
 $http_response = http_post('www.blah.com', '/test.aspx?', 'data');

can you use PEAR?

There is already a bunch of http packages

http://pear.php.net/package-search.php?pkg_name=httpbool=ANDsubmit=Search

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] HTTP_POST Intermittent Problem

2004-08-26 Thread Jay Blanchard
[snip]
I'm using the code below and about a third of the posts aren't getting 
through. We have no idea why and don't know where to start to trouble 
shoot. Any ideas? Thanks.
[/snip]

Have you checked the http access and error logs?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HTTP_POST Intermittent Problem

2004-08-26 Thread Jeff Oien
Jay Blanchard wrote:
[snip]
I'm using the code below and about a third of the posts aren't getting 
through. We have no idea why and don't know where to start to trouble 
shoot. Any ideas? Thanks.
[/snip]

Have you checked the http access and error logs?
On their end? Yes they can see each attempt to post and some that should 
have been posted (we know because we get confirmation email) didn't show 
up at all on their end. If it's on my end what would I look for? Thanks.
Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HTTP_POST Intermittent Problem

2004-08-26 Thread Jeff Oien
Matt M. wrote:
can you use PEAR?
There is already a bunch of http packages
http://pear.php.net/package-search.php?pkg_name=httpbool=ANDsubmit=Search
I've taken a look at that and don't know the first thing about how to 
implement or use it. Are there any tutorials out there? Plus, I don't 
know if this would solve the problem.
Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] http_post

2003-02-28 Thread Diana Castillo
Hi , I am trying the following code but get no response from the server, can
someone tell me what I am doing wrong? thank you.
?php
function http_post($server, $port, $url, $vars) {
// example:
//  http_post(
//  www.fat.com,
//  80,
//  /weightloss.pl,
//  array(name = obese bob, age = 20)
//  );

$urlencoded = ;
while (list($key,$value) = each($vars))
$urlencoded.= urlencode($key) . = . urlencode($value) . ;
$urlencoded = substr($urlencoded,0,-1);
$content_length = strlen($urlencoded);
$headers = POST $url HTTP/1.1
Accept:  text/plain, text/html, text/xml, image/gif, image/jpeg,
image/png, image/bmp
Accept-Charset: UTF-8
Accept-Language: en
Content-Length: $content_length
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
Host:  $server
User-Agent: Panasonic-GAD67/1.0 UP.Browser/5.0.3.5 (GUI)
Connection: Keep-Alive

;
$fp = fsockopen($server, $port, $errno, $errstr);
if (!$fp) {
return false;
}
fputs($fp, $headers);
fputs($fp, $urlencoded);

$ret = ;
while (!feof($fp))
$ret.= fgets($fp, 1024);
fclose($fp);
return $ret;
}

$request=barceloDS_requestsrequest type='destination list'
id='8'language_codeESP/language_codeagencyprimary888/primaryseco
ndary88/secondarydetail888/detailbranch1/branch/agency/request
/barceloDS_requests;

http_post(195.57.250.36,80,/barceloDS/interface/xml/,array(xml
=$request));
?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] http_post

2003-02-28 Thread Diana Castillo
I also tried the following code and get no response, can anyone tell me what
I did wrong?
?
# http_post - PHP3 class for posting a 'form' from within a php3 script
#
# Alan van den Bosch ([EMAIL PROTECTED])
#
# You are granted the right to use and/or redistribute this
# and you accept that no warranty of any kind is made or implied
#
# Methods:
# http_post()
#Returns true on success.
#$a=new http_post;
#
#Set the server of the URI you wish to post to. see also set_action()
#ie.
#or
#
# set_port(string PORT)
#Returns true on success.
#$a-set_port(8080);
#
#Set the filename of the URI you wish topost to. see also
set_action()
#ie.
#
# set_action(string ACTION)
#Returns true on success.
#$a-set_action(http://www.somehost.org:8080/incoming.php3;);
# set_enctype(string ENCTYPE)
#application/x-www-form-urlencoded or multipart/form-data
#ie.
#
# set_element(string NAME, string VALUE)
#Returns true on success.
#$a-set_element(username,John Doe);
#
#Set or update a number of name/value pairs to be posted
#ie.
#  password = dead-ringer,
#
# set_timeout(integer TIMEOUT)
#when posting. minimum value of 1 second.
#ie.
#
#Show the current internal state of an instance, for debugging.
#ie.
#
# send(boolean DISPLAY)
#can be echoed by setting DISPLAY to a true value.
#on failure.
#$a-send(1);


class http_post
{
   function http_post(){
   $this-_method=post;
   $this-_server=127.0.0.1;
   $this-_file=\\;
   $this-_port=80;
   $this-_enctype=application/x-www-form-urlencoded;
   $this-_element=array();
   $this-_timeout=20;
   }

   function set_server($newServer=){
   if(strlen($newServer)1)$newServer=$HTTP_HOST;
   $this-_server=$newServer;
   return 1;
   }

   function set_port($newPort=80){
   $newPort=intval($newPort);
   if($newPort  0 || $newPort  65535)$newPort=80;
   $this-_port=$newPort;
   return 1;
   }

   function set_file($newFile=\\){
   $this-_file=$newFile;
   return 1;
   }

   function set_action($newAction=){
   $pat=^((http://){1}([^:/]{0,}){1}(:([0-9]{1,})){0,1}){0,1}(.*);

   if(eregi($pat,$newAction,$sub)){
   if(strlen($sub[3])0)$this-_server=$sub[3];
   if(strlen($sub[5])0)$this-_port=$sub[5];
   $this-_file=$sub[6];
   return 1;
   }
   return 0;
   }

   function set_enctype($newEnctype=application/x-www-form-urlencoded){
   if($newEnctype != application/x-www-form-urlencoded 
   $newEnctype != multipart/form-data){
   $newEnctype=application/x-www-form-urlencoded;
   }
   $this-_enctype=$newEnctype;
   return 1;
   }

   function set_element($key=,$val=){
   if(is_array($key)){
   $len=sizeof($key);
   reset($key);
   for($i=0;$i$len;$i++){
   $cur=each($key);
   $k=$cur[key];
   $v=$cur[value];
   $this-_element[$k]=$v;
   }
   }
   else{
   if(strlen($key)0)$this-_element[$key]=$val;
   }
   return 1;
   }

   function set_timeout($newTimeout=20){
   $newTimeout=intval($newTimeout);
   if($newTimeout1)$newTimeout=1;
   $this-_timeout=$newTimeout;
   return 1;
   }

   function show_post(){
   $str=;
   $str.=Action:.$this-_action.br;
   $str.=Server:.$this-_server.br;
   $str.=Port:.$this-_port.br;
   $str.=File:.$this-_file.br;
   $str.=Enctype:.$this-_enctype.br;

   echo $str;

   $len=sizeof($this-_element);
   reset($this-_element);
   for($i=0;$i$len;$i++){
   $cur=each($this-_element);
   $key=$cur[key];
   $val=$cur[value];
   echoField:$key = $valbr\n;
   }
   return 1;
   }

   function send($display=0){
   // open socket to server
   $errno=$errstr=$retstr=;
   $sk = fsockopen($this-_server,
   $this-_port,
   $errno,
   $errstr,
   $this-_timeout
   );
   if(!$sk){
   return 0;
   }
   else{
   $boundary=.md5(uniqid(rand())).;
   $message=$this-_get_message($boundary);
   $str=;
   $str.=strtoupper($this-_method). ;
   $str.=$this-_file. HTTP/1.0 \r\n;
   $str.=Referer: \r\n;
   $str.=User-Agent: php-HTTP_POST/1.0 \r\n;
   $str.=Host: .$this-_server.\r\n;

   $str.=Content-type: .$this-_enctype;
   if($this-_enctype==multipart/form-data){
   $str.=; boundary=.$boundary;
   }
   $str.= \r\n;

   $str.=Content-length: .strlen($message).\r\n\r\n;
   $str.=$message;

   fputs($sk,$str);

   while(!feof($sk)){
   $resp=fgets($sk,80);
   $retstr.=$resp;
   if($display)echo $resp;
   }

   fclose($sk);
   return

Re: [PHP] HTTP_POST??

2001-01-18 Thread Chris Lee

Try this, I know Ive botched your origonal code...

somepage.php
?
 while(...)
 {
  ...
  echo "tdinput type='checkbox' name='account_num[$SkyAccNo]'
value='$SkyAccNo'/td\n";
 }
?

someotherpage.php
?
 function checked($val_1, $val_2)
 {
  if ($val_1 == $val_2)
   return " checked ";
 }

 foreach($account_num as $pos = $val)
 {
  echo "tdinput type='checkbox' name='account_num[$SkyAccNo]'
value='$SkyAccNo' " . checked(@$account_num[$pos], $SkyAccNo) . " /td\n";
 }

 while(...)
 {
  ...
  echo "tdinput type='checkbox' name='account_num[$SkyAccNo]'
value='$SkyAccNo' " . checked(@$account_num[$SkyAccNo], $SkyAccNo) . "
/td\n";
 }
?

email me if you have more questions.

Chris Lee
Mediawaveonline.com


""Wade Halsey"" [EMAIL PROTECTED] wrote in message
025401c0811c$214dfb40$256410ac@WADEH">news:025401c0811c$214dfb40$256410ac@WADEH...
Hi

I have a while loop which populates rows in a table, in each row is a
checkbox which has a unique name:

tdinput type="checkbox" name="?php print $SkyAccNo;?" value="ON"/td

On another page I want to output all the details in a specific table row,
how do I check which checkbox has been checked so that specific row can be
displayed?

Thanks for any help

Wade




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] HTTP_POST??

2001-01-17 Thread Wade Halsey

Hi

I have a while loop which populates rows in a table, in each row is a checkbox which 
has a unique name:

tdinput type="checkbox" name="?php print $SkyAccNo;?" value="ON"/td 

On another page I want to output all the details in a specific table row, how do I 
check which checkbox has been checked so that specific row can be displayed?

Thanks for any help

Wade 



[PHP] HTTP_POST

2001-01-16 Thread Wade Halsey

Hi

I have the following code which is created in a loop.

tr
  td?php print $SkyAccNo; ?/td
  td?php print $SkyDateAss; ?/td
  td?php print $SkyDateResult; ?/td
  tdinput type="checkbox" name="?php echo$SkyAccNo;?" value="ON"/td
/tr

For example there will be three rows with different values and each checkbox will have 
a unique name.
On the next page once a submit button has been pushed I want to do:
sqlExecute( "Select * from SkyDiary where AccNo = (Here I want the value of the 
checkbox)

Do I use HTTP_POST_VARS here and if so how??
Thanks

Wade Halsey
[EMAIL PROTECTED]




[PHP] HTTP_POST???

2001-01-16 Thread Wade Halsey

Hi

I have the following code which is created in a loop.

tr
  td?php print $SkyAccNo; ?/td
  td?php print $SkyDateAss; ?/td
  td?php print $SkyDateResult; ?/td
  tdinput type="checkbox" name="?php echo$SkyAccNo;?" value="ON"/td
/tr

For example there will be three rows with different values and each checkbox will have 
a unique name.
On the next page once a submit button has been pushed I want to do:
sqlExecute( "Select * from SkyDiary where AccNo = (Here I want the value of the 
checkbox)

Do I use HTTP_POST_VARS here and if so how??
Thanks

Wade Halsey
[EMAIL PROTECTED]