我正在尝试执行此卷曲,如下所示。但在执行时会给我一个错误
( ! ) Notice: Array to string conversion in C:\wamp\www\XXX\workerInsBusiness.php on line 75
Call Stack
# Time Memory Function Location
1 0.0017 269704 {main}( ) ..\workerInsBusiness.php:0
2 0.0073 285048 curl_setopt_array ( ) ..\workerInsBusiness.php:75
完成资源
$name=$_POST['name'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$city_ref=$_POST['cityselect'];
$area_ref=$_POST['areaselect'];
$address=$_POST['address'];
$region=$_POST['region'];
$dist=$_POST['dist'];
$pincode=$_POST['pin'];
$category=$_POST['category'];
$shopname=$_POST['shopname'];
$url=$_POST['url'];
$businessdetails=$_POST['busdetails'];
$score=$_POST['score'];
$file=$_FILES['img']["name"];
$verification=$_POST['verification'];
$dt = date("ydmhms");
if(!$file)
{
$newfn="Noimage";
}
else
{
$name=explode(".",$file);
$newfn = 'kdial_'.$dt.".".$name[1];
}
if($_FILES["img"]["error"]>0)
{
$_SESSION["E_MESSAGE"]="Problem while uploading file, Please try again";
header("Location: home.php");
}
else
{
if((($_FILES["img"]["type"]=="image/jpeg")||($_FILES["img"]["type"]=="image/png"))&&($_FILES["img"]["size"]<=3145728))
{//&&($_FILES["UFILE"]["size"]>50000)){
//echo "File is ready to upload";
if(file_exists("uploads/".$_FILES["img"]["name"]))
{
$_SESSION["E_MESSAGE"]="File already exist, Please try again";
header("Location: home.php");
}
else
{
move_uploaded_file($_FILES["img"]["tmp_name"],"uploads/".$newfn);
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => "http://localhost:91/XXXX/allServices/insertBusiness.php",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => array(
'name' => $name,
'phone' => $phone,
'email' => $email,
'cityselect' => $city_ref,
'areaselect' => $area_ref,
'address' => $address,
'region' => $region,
'dist' => $dist,
'pin' => $pincode,
'category' => $category,
'shopname' => $shopname,
'url' => $url,
'busdetails' => $businessdetails,
'score' => $score,
'fn' => $newfn ,
'verification' => $verification,
)
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
if (curl_errno($ch))
{
// this would be your first hint that something went wrong
die('Couldn\'t send request: ' . curl_error($ch));
}
curl_close($ch);
//print_r("soham ".$result);
$jsonobj = json_decode($result);
print_r("json obj ".$jsonobj);
exit();
}
}
else
{
$_SESSION["ERROR"]="Invalid File";
header("Location: home.php");
}
}
文件上传工作正常。 执行这个卷曲有什么问题我搜索了很多我发现有些东西说你必须使用http_build_query()但我不知道如何使用这个