note 85155 added to function.fsockopen

From: Date: Mon, 18 Aug 2008 10:34:17 +0000
Subject: note 85155 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-143580@lists.php.net to get a copy of this message
Sending multiple files with form(modification of sir_reality2001 at yahoo dot com's and Duukkis's scripts): $boundary = "AaB03x"; $boundary2 = "BbC04y"; // Build the header $header = "POST remoteurl HTTP/1.0\r\n"; $header .= "Host: remotehost\r\n"; $header .= "Content-Type: multipart/form-data; boundary=$boundary\r\n"; // attach post vars foreach($_POST AS $index => $value){ $data .="--$boundary\r\n"; $data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n"; $data .= "\r\n".$value."\r\n"; $data .="--$boundary\r\n"; } // and attach the file for ($i=0; $i<count($_FILES['userfile']['name']);$i++) { $data .= "--$boundary\r\n"; if ($_FILES['userfile']['name'][$i] != '') { $content_file = join("", file($_FILES['userfile']['tmp_name'][$i])); $data.="Content-Disposition: file; name=\"userfile[$i]\"; filename=\"".$_FILES['userfile']['name'][$i]."\"\r\n"; $data .= "Content-Type: ".$_FILES['userfile']['type'][$i]."\r\n\r\n"; $data .= "".$content_file."\r\n"; $data .="--$boundary\r\n"; } } $data .="--$boundary--\r\n"; $header .= "Content-length: " . strlen($data) . "\r\n\r\n"; $fp = fsockopen($remote_server, 80); ---- Server IP: 82.160.94.10 Probable Submitter: 83.5.102.218 ---- Manual Page -- http://www.php.net/manual/en/function.fsockopen.php Edit -- https://master.php.net/note/edit/85155 Del: integrated -- https://master.php.net/note/delete/85155/integrated Del: useless -- https://master.php.net/note/delete/85155/useless Del: bad code -- https://master.php.net/note/delete/85155/bad+code Del: spam -- https://master.php.net/note/delete/85155/spam Del: non-english -- https://master.php.net/note/delete/85155/non-english Del: in docs -- https://master.php.net/note/delete/85155/in+docs Del: other reasons-- https://master.php.net/note/delete/85155 Reject -- https://master.php.net/note/reject/85155 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#143580) next »