Skip to content

Instantly share code, notes, and snippets.

@Ttech
Created July 27, 2012 02:02
Show Gist options
  • Save Ttech/3185775 to your computer and use it in GitHub Desktop.
Save Ttech/3185775 to your computer and use it in GitHub Desktop.
<?php
function sanitize($string){
// strip anything, maybe url encode too
return strval(stripslashes($string));
}
function forward_post_data($end_url){
$post_string = "";
if(isset($_POST)){
foreach($_POST as $key => $value){
$post_string .= sanitize($key)."=".sanitize(urlencode($value))."&";
}
$cs = curl_init($end_curl);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post_string);
// Now we need to execute it
if(curl_exec($ch)){
return TRUE;
} else {
return FALSE;
}
curl_close($ch);
} else {
return FALSE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment