Home > php_mysql > PHP post without cUrl

PHP post without cUrl

< ?php

$postdata = http_build_query(
    array(
        'var1' => 'some content',
        'var2' => 'doh'
    )
);
$opts = array('http' =>
    array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
    )
);
$context  = stream_context_create($opts);
$result = file_get_contents('http://example.com/submit.php', false, $context);

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

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