note 72017 added to function.stream-context-create

From: Date: Fri, 29 Dec 2006 06:18:24 +0000
Subject: note 72017 added to function.stream-context-create
Groups: php.notes 
Request: Send a blank email to php-notes+get-120999@lists.php.net to get a copy of this message
Here's a very simple way to do posts easily without need of cURL or writing an http request by hand using the tcp:// wrapper. I like using contexts just because of their ubiquity and the lack of an optional library such as cURL (though one of the more popular libraries). <?php $options = array( 'http'=>array( 'method'=>"POST", 'header'=> "Accept-language: en\r\n". "Content-type: application/x-www-form-urlencoded\r\n", 'content'=>http_build_query(array('foo'=>'bar')) )); $context = stream_context_create($options); fopen('http://www.example.com/',false,$context); ?> ---- Server IP: 66.207.199.35 Probable Submitter: 24.32.227.120 ---- Manual Page -- http://www.php.net/manual/en/function.stream-context-create.php Edit -- https://master.php.net/note/edit/72017 Del: integrated -- https://master.php.net/note/delete/72017/integrated Del: useless -- https://master.php.net/note/delete/72017/useless Del: bad code -- https://master.php.net/note/delete/72017/bad+code Del: spam -- https://master.php.net/note/delete/72017/spam Del: non-english -- https://master.php.net/note/delete/72017/non-english Del: in docs -- https://master.php.net/note/delete/72017/in+docs Del: other reasons-- https://master.php.net/note/delete/72017 Reject -- https://master.php.net/note/reject/72017 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120999) next »