HTTP POST with CURL

Discussion in 'PHP' started by misslilbit02, Oct 22, 2007.

  1. #1
    I'm receiving post from various vendors...and I'm trying to send a response back to them saying whether I received the post sucessfully or not. My thoughts were to use CURL. I'm not totally clear as to how I should handle this but this is what I did. I collected the info posted to one page then via CURL I redirected the information to another page that says wether or not the the post was successful and based on wether it was successful or not then the script is redirected to a confirmation page.

    My biggest issue is I'm trying to send a response to the server that posted to me saying wether or not the post was successful.

    Can someone please direct me in the right direction?
     
    misslilbit02, Oct 22, 2007 IP
  2. misslilbit02

    misslilbit02 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Where does the response fit in all of this?

    $request = '';
    	foreach ($_GET as $key => $value) {
    	$value = urlencode(stripslashes($value));
    	if ( $body != '' ) {
    	$body.= '&';
    	}
    	$body.= "$key=$value";
    	}
    
    	$ch = curl_init();
    		curl_setopt($ch, CURLOPT_URL, 'http://posts.keiserschools.net/vendor_response.php' );
    		curl_setopt($ch, CURLOPT_HEADER, 1);
    		curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
    		curl_setopt($ch, CURLOPT_POST, 1);
    		curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    		$output = curl_exec($ch);
    		curl_close($ch);
    
    	
    	if (strstr($output, "Success") ) {
    
                header("Location: http://posts.keiserschools.net/confirmation.htm");
    	}
    
    	else {
    
                header("Location: http://www.keiseruniversity.edu/no_confirmation.htm");
    		}
    
    PHP:
     
    misslilbit02, Oct 22, 2007 IP