Can someone please help me with this. I have gone to forum after forum and read books and just have no idea how to do this.
I need to send a server response in PHP. I'm attempting to do with CURL. I might be making this harder than need be because I over think things and then I get myself all confused.
This is the scenario...I have vendors that post to PHP script. I grab the information and put it in the database. My delimna is my vendors want a success/failure server response. One of the catches is...I have to go to a confirmation and send this server response. How do I go about doing this? My code is below if you have a better way of doing it please let me know. Please help!!!! My logic below is a little different. I was trying to get the URL that sent me the post so that I could send them a response. I might be going about it wrong.
[PHP]$request = '';
foreach ($_GET as $key => $value) {
$value = urlencode(strip slashes($value) );
if ( $request != '' ) {
$request.= '&';
}
$request.= "$key=$valu e";
}
$curl_handle = curl_init();
$url = getenv("HTTP_RE FERER");
curl_setopt($cu rl_handle, CURLOPT_URL, $url);
curl_setopt($cu rl_handle, CURLOPT_HEADER, 1);
curl_setopt($cu rl_handle, CURLOPT_USERAGE NT, $_SERVER['HTTP_USER_AGEN T']);
curl_setopt($cu rl_handle, CURLOPT_POST, 1);
curl_setopt($cu rl_handle, CURLOPT_POSTFIE LDS, $request);
curl_setopt($cu rl_handle, CURLOPT_RETURNT RANSFER,1);
$response = curl_exec ($curl_handle);
echo $response;
[/PHP]
I need to send a server response in PHP. I'm attempting to do with CURL. I might be making this harder than need be because I over think things and then I get myself all confused.
This is the scenario...I have vendors that post to PHP script. I grab the information and put it in the database. My delimna is my vendors want a success/failure server response. One of the catches is...I have to go to a confirmation and send this server response. How do I go about doing this? My code is below if you have a better way of doing it please let me know. Please help!!!! My logic below is a little different. I was trying to get the URL that sent me the post so that I could send them a response. I might be going about it wrong.
[PHP]$request = '';
foreach ($_GET as $key => $value) {
$value = urlencode(strip slashes($value) );
if ( $request != '' ) {
$request.= '&';
}
$request.= "$key=$valu e";
}
$curl_handle = curl_init();
$url = getenv("HTTP_RE FERER");
curl_setopt($cu rl_handle, CURLOPT_URL, $url);
curl_setopt($cu rl_handle, CURLOPT_HEADER, 1);
curl_setopt($cu rl_handle, CURLOPT_USERAGE NT, $_SERVER['HTTP_USER_AGEN T']);
curl_setopt($cu rl_handle, CURLOPT_POST, 1);
curl_setopt($cu rl_handle, CURLOPT_POSTFIE LDS, $request);
curl_setopt($cu rl_handle, CURLOPT_RETURNT RANSFER,1);
$response = curl_exec ($curl_handle);
echo $response;
[/PHP]
Comment