PHP模拟POST传输图片问题
想通过模拟POST的方法传输图片,这是服务端
<?php
$URL = 'http://localhost/phppost/test2.php';
$img_file = 'D:\xampp\htdocs\byte.jpg';
$fp1 = fopen($img_file, 'rb');
$content = fread($fp1, filesize($img_file)); //二进制数据
$post_data['tu']=$content;
$referrer="";
$URL_Info=parse_url($URL);
if($referrer=="")
{
$referrer=$_SERVER["SCRIPT_URI"];
}
foreach ($post_data as $key=>$value)
{
$values[]="$key=".urlencode($value);
}
$data_string=implode($values);
if (!isset($URL_Info["port"])) {
$URL_Info["port"]=80;
$request.="POST ".$URL_Info["path"]." HTTP/1.1\n";
$request.="Host: ".$URL_Info["host"]."\n";
$request.="Referer: $referrer\n";
$request.="Content-type: application/x-www-form-urlencoded\n";
$request.="Content-length: ".strlen($data_string)."\n";
$request.="Connection: close\n";
$request.="\n";
$request.=$data_string."\n";
}
$fp = fsockopen($URL_Info["host"], $URL_Info["port"]);
fputs($fp, $request);
while(!feof($fp)) {
$result .= fgets($fp
相关问答:
<?php
if($_SERVER['HTTP_REFERER']!=''){
@header("Content-type:image/jpeg");
echo file_get_contents("xlight.jpg");
}
else{
@header("location:ht ......
刚接触这个东西,想问一下各位高手实践这个需要哪些工具(我用的linux,dreamweaver)?具体怎么实现?求一个简单完整的例子
网上搜索nusoap
去“w3学校”学下xml
不过网上比较难找那种完整的例子,只有简 ......
webclient.php文件:
<?php
$arrOptions = array( 'uri'=>'http://10.10.19.111/','location'=>'http://10.10.19.111/webservice/webservice.php','trace' ......
<html>
<head>
<title>hello </title>
</head>
<body>
<input type="button" value="Click" onClick=" ......
如题
新网的~
不知道哪家好。我用香港主机还行
引用
新网的~
这个好吗?用起来很慢,我现在用的佰网的,http://www.hb666.net/
DreamHost
美国,世界第一流的收费空间
国外空间的话 ......