Advertisement
GWibisono

test

May 15th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2. if($_POST)
  3. {
  4.     print_r($_POST);
  5. die();
  6. }
  7. $postdata = http_build_query(
  8.     array(
  9.         'var1' => 'some content',
  10.         'var2' => 'doh'
  11.     )
  12. );
  13.  
  14. $opts = array('http' =>
  15.     array(
  16.         'method'  => 'POST',
  17.         'header'  => 'Content-type: application/x-www-form-urlencoded',
  18.         'content' => $postdata
  19.     )
  20. );
  21.  
  22. $context  = stream_context_create($opts);
  23. $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  24. $result = file_get_contents($url, false, $context);
  25.  
  26. print_r($result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement