Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function postDataViaCurl($url,$parameters){
- $ch = curl_init() or die("Sorry you need to have cURL extension Enabled");
- $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
- $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
- $header[] = "Cache-Control: max-age=0";
- $header[] = "Connection: keep-alive";
- $header[] = "Keep-Alive: 300";
- $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
- $header[] = "Accept-Language: en-us,en;q=0.5";
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12");
- curl_setopt($ch, CURLOPT_REFERER, $url);
- curl_setopt($ch, CURLOPT_POST, 1 );
- curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $postResult = curl_exec($ch);
- if (curl_errno($ch)) {
- return false;
- }
- curl_close($ch);
- return $postResult;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement