Page 1 of 1

what kind of response is this?

Posted: Fri Aug 24, 2007 12:31 pm
by JellyFish
HTTP/1.0 302 Moved Temporarily Location
What kind of HTTP response is this? I googled it, and I don't understand what it means? I sent a request using the POST method.

Posted: Fri Aug 24, 2007 12:34 pm
by Oren
Hmm... It's pretty much straight forward, isn't it?

Posted: Fri Aug 24, 2007 12:46 pm
by JellyFish
Oren wrote:Hmm... It's pretty much straight forward, isn't it?
I'm sorry for being dubious, but I'm not understanding to my fullest extent. Please explain why it's straight forward, and more importantly: what it's straight forward to.

Posted: Fri Aug 24, 2007 12:53 pm
by VladSun

Posted: Fri Aug 24, 2007 1:06 pm
by Oren
JellyFish wrote:Please explain why it's straight forward, and more importantly: what it's straight forward to.
Because it says: "Moved Temporarily Location" :P

Posted: Fri Aug 24, 2007 1:20 pm
by JellyFish
Oren wrote:
JellyFish wrote:Please explain why it's straight forward, and more importantly: what it's straight forward to.
Because it says: "Moved Temporarily Location" :P
What's "Moved Temporarily"? The file I made request to? If so, why would that file have moved? Or does this mean that the page that I made the request to has redirected to another page?

EDIT: To be more specific, what kind of response is this:
HTTP/1.0 302 Moved Temporarily Location: https://www.linkpointcentral.com/lpc/servlet/lppay X-Cache: MISS from wc04.inet.mesa1.secureserver.net Connection: close 168
?

Posted: Fri Aug 24, 2007 3:29 pm
by pickle
Basically 302 is similar to 404 in that the file you requested isn't there. 302 means that the file has been moved temporarily.

Posted: Fri Aug 24, 2007 3:38 pm
by JellyFish
pickle wrote:Basically 302 is similar to 404 in that the file you requested isn't there. 302 means that the file has been moved temporarily.
Okay, why wouldn't it be there?

Here's my full on script metropolis:

http.php

Code: Select all

<?php
	function HttpRequest($address, $data)
	{
		$url = parse_url($address);
		
		while (list($key, $value) = each($data))
		{
			$dataToPost .= "$key=$value&";
		}
		$dataToPost = rtrim($dataToPost, "&");
		
		$request = 	"POST ".$url['path']." HTTP/1.1\r\n"
				. "Host: ".$url['host']."\r\n"
				. "Content-Type: application/x-www-form-urlencoded;\r\n"
				. "Content-Length: ".strlen($dataToPost)."\r\n"
				. "\r\n"
				. $dataToPost;
		
		$socket = @fsockopen($url['host'], 80, $errno, $errstr) or die("Error: unable to open a socket connection with ".$url['host']."\n $errno: $errstr");
		fwrite($socket, $request);
		
		// Response
		$response = '';
		while (!feof($socket)) {
		    $response .= fpassthru($socket);
		}
		fclose($socket);
		
		return $response;
	}
?>
index.php

Code: Select all

$myorder["host"]       = "secure.linkpt.net";
			$myorder["port"]       = "1129";
			$myorder["keyfile"]    = "/home/content/******html/lpAPI/cert.pem"; # Change this to the name and location of your certificate file 
			$myorder["storename"] = "1085600";        # Change this to your store number 
		
			$myorder["txntype"]    = "SALE";
			$myorder["chargetotal"]  = "2.95";
			$myorder["cardnumber"]   = $_POST['ccard_num'];
			$myorder["expmonth"] = $_POST['ccard_exp_month'];
			$myorder["expyear"]  = $_POST['ccard_exp_year'];
			$myorder["cvm"]      = $_POST['CID'];   # Required for AVS. If not provided, transactions will downgrade.
			$myorder["zip"]          = $_POST['zip']; # Required for AVS. If not provided, transactions will downgrade.
			$myorder["debugging"]    = "true";  # for development only - not intended for production use
			
			# periodic fields
		/*	$myorder["action"]       = "SUBMIT";
			$myorder["installments"] = "1";
			$myorder["threshold"]    = "3";
			$myorder["startdate"]    = "immediate";
			$myorder["periodicity"]  = "monthly"; */
			
			# Send transaction. Use one of two possible methods  #
			$transaction = HttpRequest("https://www.linkpointcentral.com/lpc/servlet/lppay", $myorder);				//$lpObj->curl_process($myorder) or die("Fialed at sending the transaction using curl_process method!");  # use curl methods
			
			exit($transaction);
So what I do is build up an array of data to post to somewhere. I call the HttpRequest function and pass the URL of where to post and the array to post.

In the HttpRequest function definition I take the $address parameter and break it up into url parts with the parse_url function. I also break the $data parameter into parts and format it in a http request data string(this I know works).

Maybe the problem is in the $address parameter handling???

Thank you so much for the post. You don't know how much I appreciate them.

Posted: Fri Aug 24, 2007 3:41 pm
by Citizen
JellyFish,

A 302 usually means that someone places a bit of code (either in php or on the .htaccess file, etc) that is redirect you another page or report an error. Webmasters use this to direct users and search engines to the correct page.

For instance, if I temporarily renamed a file, i'd use a 302 to not waste any incoming links for SEO purposes.

Posted: Fri Aug 24, 2007 3:48 pm
by JellyFish
Citizen wrote:JellyFish,

A 302 usually means that someone places a bit of code (either in php or on the .htaccess file, etc) that is redirect you another page or report an error. Webmasters use this to direct users and search engines to the correct page.

For instance, if I temporarily renamed a file, i'd use a 302 to not waste any incoming links for SEO purposes.
So 302 code means that the page that I sent the request to has redirected to another page? If that's the case then why wasn't the response the contents of the page it redirected to?

Posted: Fri Aug 24, 2007 4:22 pm
by feyd
Why do you have three threads for the same piece of code?

Posted: Fri Aug 24, 2007 4:38 pm
by JellyFish
feyd wrote:Why do you have three threads for the same piece of code?
It started out as three different questions. Sorry, I didn't have my head on straight.