Skip to content

Instantly share code, notes, and snippets.

@chrismeller
Created October 18, 2010 19:45
Show Gist options
  • Save chrismeller/632901 to your computer and use it in GitHub Desktop.
Save chrismeller/632901 to your computer and use it in GitHub Desktop.
<?php
$file = $argv[1];
$type = isset( $argv[2] ) ? $argv[2] : 'php';
$contents = file_get_contents( $file );
$url = 'http://localhost/test/post.php';
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query( array( 'content' => $contents, 'type' => $type ) ),
)
);
$context = stream_context_create( $options );
$result = file_get_contents( $url, false, $context );
echo $result;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment