Submitting the form from the site

In general, I’m new to PHP, I used to have such a script (I wrote it from a book), but I lost it. Please help me to do this simple thing. There is a website:

site.com/test/test2/index.php?action=send_s&msisdn=_&from=__&msg=__&submit=Send

What needs to be done is for me to be able to submit a form from my site, but still send a request to that site. And that site should not be displayed at all.


Answer 1, authority 100%


<?
    $data="var=test&var2=privet";
    $fp = fsockopen("test.ru", 80, $errno, $errstr, 10);
    $out = "POST /file.php HTTP/1.1\n";
    $out .= "Host: test.ru\n";
    $out .= "Referer: test.ru/\n";
    $out .= "User-Agent: Opera\n";
    $out .= "Content-Type: application/x-www-form-urlencoded\n";
    $out .= "Content-Length: ".strlen($data)."\n\n";
    $out .= $data."\n\n";
    fputs($fp, $out);
    fclose($fp);
?>

More

<?
$url = "http://test.ru/patch/file.php?var=23&var2=54"; //  ,       POST.  ,   ,     GET
$parse_url = parse_url($url); //        ,    ,    .
$path = $parse_url["path"]; //   (/patch/file.php)
if($parse_url["query"]) //    
$path .= "?" . $parse_url["query"]; //       (?var=23&var2=54)
$host= $parse_url["host"]; //    (test.ru)
$data = "var3=test&var4=".urlencode(" "); //        .      POST.       urlencode (" ")
$fp = fsockopen($host, 80, $errno, $errstr, 10);
if ($fp)
{
  $out = "POST ".$path." HTTP/1.1\n";
  $out .= "Host: ".$host."\n";
  $out .= "Referer: ".$url."/\n";
  $out .= "User-Agent: Opera\n";
  $out .= "Content-Type: application/x-www-form-urlencoded\n";
  $out .= "Content-Length: ".strlen($data)."\n\n";
  $out .= $data."\n\n";
  fputs($fp, $out); //  
  //            ,    ...
  //      . ,       .
  while($gets=fgets($fp,2048))
  {
    print $gets;
  }
  fclose($fp);
}
?>

In this example, file.php got variables:

GET var=”23″ and var2=”54″

POST var3=”test” and var4=”more test”


Answer 2

Will you decide if you have a GET or POST request?

<form method="POST" action="http://site.com/test/test2/index.php" name="">

and all the fields from that form paste in your place and send a request
if GET
<form method=”GET” action=”http://site.com/test/test2/index.php” name=””>