Home > php_mysql > PHP post without cUrl

PHP post without cUrl

PHP:
  1. <?php
  2.  
  3. $postdata = http_build_query(
  4.     array(
  5.         'var1' => 'some content',
  6.         'var2' => 'doh'
  7.     )
  8. );
  9. $opts = array('http' =>
  10.     array(
  11.         'method'  => 'POST',
  12.         'header'  => 'Content-type: application/x-www-form-urlencoded',
  13.         'content' => $postdata
  14.     )
  15. );
  16. $context  = stream_context_create($opts);
  17. $result = file_get_contents('http://example.com/submit.php', false, $context);
  18.  
  19. ?>

Categories: php_mysql Tags:
  1. No comments yet.
  1. No trackbacks yet.

0 pages viewed, 0 today
0 visits, 0 today
FireStats icon Powered by FireStats