Created
July 27, 2012 02:02
-
-
Save Ttech/3185775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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