note 95734 added to function.httprequest-send

From: Date: Tue, 19 Jan 2010 05:22:03 +0000
Subject: note 95734 added to function.httprequest-send
Groups: php.notes 
Request: Send a blank email to php-notes+get-165101@lists.php.net to get a copy of this message
Example how to use HttpRequest to post data and receive the response: <?php //set up variables $theData = '<?xml version="1.0"?> <note> <to>php.net</to> <from>lymber</from> <heading>php http request</heading> <body>i love php!</body> </note>'; $url = 'http://www.example.com'; $credentials = 'user@example.com:password'; $header_array = array('Expect' => '', 'From' => 'User A'); $ssl_array = array('version' => SSL_VERSION_SSLv3); $options = array(headers => $header_array, httpauth => $credentials, httpauthtype => HTTP_AUTH_BASIC, protocol => HTTP_VERSION_1_1, ssl => $ssl_array); //create the httprequest object $httpRequest_OBJ = new httpRequest($url, HTTP_METH_POST, $options); //add the content type $httpRequest_OBJ->setContentType = 'Content-Type: text/xml'; //add the raw post data $httpRequest_OBJ->setRawPostData ($theData); //send the http request $result = $httpRequest_OBJ->send(); //print out the result echo "<pre>"; print_r($result); echo "</pre>"; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 210.10.104.2 ---- Manual Page -- http://www.php.net/manual/en/function.httprequest-send.php Edit -- https://master.php.net/note/edit/95734 Del: integrated -- https://master.php.net/note/delete/95734/integrated Del: useless -- https://master.php.net/note/delete/95734/useless Del: bad code -- https://master.php.net/note/delete/95734/bad+code Del: spam -- https://master.php.net/note/delete/95734/spam Del: non-english -- https://master.php.net/note/delete/95734/non-english Del: in docs -- https://master.php.net/note/delete/95734/in+docs Del: other reasons-- https://master.php.net/note/delete/95734 Reject -- https://master.php.net/note/reject/95734 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165101) next »