$url = '';
$data = array('a'=> 'b');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$ret = curl_exec($ch);
curl_close($ch);
$url = ''; $file = '1.jpg'; $field['uploadFile'] = '@'.$file;(uploadFile为接收端的name名) $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $field); $ret = curl_exec($ch); curl_close($ch);
$uploadInfo = array(
'host'=>'',
'port'=>'80',
'url'=>'/upload.php'
);
$fp = fsockopen($uploadInfo['host'],$uploadInfo['port'],$errno,$errstr);
$file = '1.jpg';
$content = file_get_contents($file);
$boundary = md5(time());
$out.="--".$boundary."\r\n";
$out.="Content-Disposition: form-data; name=\"uploadFile\"; filename=\"".$file."\"\r\n";
$out.="Content-Type: image/jpg\r\n\r\n";
$out.=$content."\r\n";
$out.="--".$boundary."\r\n";
fwrite($fp,"POST ".$uploadInfo['url']." HTTP/1.1\r\n");
fwrite($fp,"Host:".$uploadInfo['host']."\r\n");
fwrite($fp,"Content-Type: multipart/form-data; boundary=".$boundary."\r\n");
fwrite($fp,"Content-length:".strlen($out)."\r\n\r\n");
fwrite($fp,$out);
while (!feof($fp)){
$ret .= fgets($fp, 1024);
}
fclose($fp);
$ret = trim(strstr($ret, "\r\n\r\n"));
preg_match('/http:.*/', $ret, $match);
return $match[0];
$fp = fsockopen($host, 80, $errno, $errstr, 30);
$fp = pfsockopen($host, 80, $errno, $errstr, 30);
$fp = fsockopen($host, 80, $errno, $errstr, 30);
$fp = stream_socket_client($host."80", $errno, $errstr, 30);
function b_fsockopen($host, $port, &$errno, &$errstr, $timeout) {
$ip = gethostbyname($host);
$s = socket_create(AF_INET, SOCK_STREAM, 0);
if (socket_set_nonblock($s)) {
$r = @socket_connect($s, $ip, $port);
if ($r || socket_last_error() == EINPROGRESS) {
$errno = EINPROGRESS;
return $s;
}
}
$errno = socket_last_error($s);
$errstr = socket_strerror($errno);
socket_close($s);
return false;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有