[PHP] posting without a from
I am trying to post to another server without a form. The input is from a form on my server. I log the entry in MySQL and then pass the input to this function to open the connection and return a query result. The post to the other server requires authentication in the form of USERID and PASSWORD. At first this function returned "HTTP 1.1/ Authentication Required" and now it is timing out. Incidentally, I have posted this data directly from a form with no problems. Anyone know why this isn't working? function process_CRIS($USERID, $PASSWORD, $S_S, $S_M, $SRCH__LNAME, $SRCH__FNAME) { $url = "http://10.0.0.10/premium/comb/Results.phtml";; $url = preg_replace("@^http://@i";, "", $url); $host = substr($url, 0, strpos($url, "/")); $uri = strstr($url, "/"); $UserID = ""; $Password = "x"; $reqbody="USERID=".urlencode($UserID); $reqbody=$reqbody."&PASSWORD=".urlencode($Password); $reqbody = $reqbody."&S_S=".urlencode($S_S); // $S_S can consist of an array of possible search parameters that need to be concatenated to ab,ac,ad, etc. if (isset($S_S)){ foreach($S_S as $key=>$val) { if ($key == 0){ $reqbody = $reqbody."&S_S=".urlencode($val);} else {$reqbody = $reqbody.",".urlencode($val);} } } if (isset($S_M)){ foreach($S_M as $key=>$val) { if ($key == 0){$reqbody = $reqbody."&S_M=".urlencode($val);} else {$reqbody = $reqbody.",".urlencode($val);} } } $reqbody = $reqbody ."&SRCH__LNAME=".urlencode($SRCH__LNAME)."&SRCH__FNAME=". urlencode($SRCH__FNAME); $contentlength = strlen($reqbody); $reqheader = "POST $uri HTTP/1.1\r\n". "Host: $host\n". "Content-Type: application/x-www-form-urlencoded\r\n". "Content-Length: $contentlength\r\n". "$reqbody\r\n"; $socket = fsockopen($host, 80, $errno, $errstr); if (!$socket) { $result = "Error: ".$errno. $errstr; return $result; exit; } fputs($socket, $reqheader); $result = fgets($socket, 4096); fclose($socket); return $result; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can you find the parse error?
What's wrong with this code that it would give this error? Parse error: parse error, expecting `','' or `';'' $query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address, State, City, Zip, Phone, Fax, email, fee) VALUES ('".$UserID."', '".$Complex."', '".$Contact."', '".$Address."', '".$State."', '".$City."', '".$Zip."', '".$Phone."', '".$Fax."', '".$email."', '".$fee."')"; I think I've been staring at it too long. I can't find it. Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can you find the parse error?
There are a couple of carriage returns, but this has never affected any of my other code. I'm using dreamweaver. -Original Message- From: Henning, Brian [mailto:[EMAIL PROTECTED]] Sent: Friday, March 29, 2002 1:55 PM To: 'Eric Kilgore' Subject: RE: [PHP] Can you find the parse error? is there a carrage return in the middle of the statement? what editor are you using? it might be wrapping wrong -Original Message----- From: Eric Kilgore [mailto:[EMAIL PROTECTED]] Sent: Friday, March 29, 2002 3:46 PM To: php-general (E-mail) Subject: [PHP] Can you find the parse error? What's wrong with this code that it would give this error? Parse error: parse error, expecting `','' or `';'' $query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address, State, City, Zip, Phone, Fax, email, fee) VALUES ('".$UserID."', '".$Complex."', '".$Contact."', '".$Address."', '".$State."', '".$City."', '".$Zip."', '".$Phone."', '".$Fax."', '".$email."', '".$fee."')"; I think I've been staring at it too long. I can't find it. Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can you find the parse error?
Good to know I'm not going crazy. I found the error in the previous function. I failed to end an echo statement and the next quote on that page was this statement. Doh. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Friday, March 29, 2002 2:08 PM To: Eric Kilgore Cc: php-general (E-mail) Subject: Re: [PHP] Can you find the parse error? On Fri, 29 Mar 2002, Eric Kilgore wrote: > What's wrong with this code that it would give this error? > > Parse error: parse error, expecting `','' or `';'' > > $query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address, State, > City, Zip, Phone, >Fax, email, fee) VALUES ('".$UserID."', '".$Complex."', '".$Contact."', > '".$Address."', > '".$State."', '".$City."', '".$Zip."', '".$Phone."', '".$Fax."', > '".$email."', '".$fee."')"; > > I think I've been staring at it too long. I can't find it. I don't see an error, but wouldn't it be easier (and faster) to write: $query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address, State, City, Zip, Phone, Fax, email, fee) VALUES ('$UserID', '$Complex', '$Contact', '$Address', '$State', '$City', '$Zip', '$Phone', '$Fax', '$email', '$fee')"; without all the concatenation? miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie configuration question
I'm a newbie to Linux and Apache, not so new to php itself. I'm using Red Hat 7.2. The RPM installs apache with php, etc. as part of the standard install but --without-mysql in the configuration. I've read quit a bit on how you are supposed to be able to update the configuration etc. ./configure --with-mysql=/usr/bin/mysql etc. The trouble is I have no clue as to what directory I'm suppose to be running this in. I'm tempted to install a newer version of PHP (Red Hat 7.2 comes with 4.0.6) as the documentation on installing from source code seems to be a bit clearer. Can I install over the top of the existing module or would I have to uninstall that package first? Any help would be greatly appreciated. Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie configuration question
Interestingly, php-mysql-4.0.6-7.i38.rpm is installed, but phpinfo still shows --without-mysql -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 9:05 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] newbie configuration question On Saturday 06 April 2002 11:12, Eric Kilgore wrote: > I'm a newbie to Linux and Apache, not so new to php itself. I'm using Red > Hat 7.2. The RPM installs apache with php, etc. as part of the standard > install but --without-mysql in the configuration. I've read quit a bit on > how you are supposed to be able to update the configuration etc. > ./configure --with-mysql=/usr/bin/mysql etc. The trouble is I have no clue > as to what directory I'm suppose to be running this in. I'm tempted to > install a newer version of PHP (Red Hat 7.2 comes with 4.0.6) as the > documentation on installing from source code seems to be a bit clearer. Can > I install over the top of the existing module or would I have to uninstall > that package first? If all you want is to add mysql support in php then its just a matter of installation relevant RPM(s) which for RH7.2 is php-mysql-4.0.6-7.i386.rpm. I would advise against mixing RPM and source installs for Apache-PHP. My own preference is to install AMP (Apache, MySQL, PHP) from source. Search google for 'lamp php apache' to find the LAMP guide which shows you how to install all 3 from source. DevShed also has a nice guide called "The Soothingly Seamless Setup of Apache, SSL, MySQL ,and PHP". -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* As Zeus said to Narcissus, "Watch yourself." */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php