这是我用于visenze的卷曲请求:
<?php
$accessKey = '*********';
$secretKey = '*********';
$lengthad = intval($_POST['lengtha'])-1;
$lengthap = intval($_POST['lengtha'])+1;
// Initialize the cURL request to ViSenze
$ch = curl_init('http://visearch.visenze.com/uploadsearch');
//echo $ch;
// We want to RETURN the result not output it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set up the basic authentication settings
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $accessKey.":".$secretKey);
// Define the post fields
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'im_url' => $_POST['im_url'],
'score' => $_POST['score'],
/*'score_min' => $_POST['score_min'],*/
'get_all_fl' => $_POST['get_all_fl'],
'fl' => 'im_name',
'fl' => 'im_url',
'fl' => 'category',
'fq'=> 'category:'.intval($_POST['cat']),
'fq'=> 'lengtha:'.$lengthad.','.$lengthap
]);
//echo $ch;
//exit;
// Do the request
$result = curl_exec($ch);
curl_close($ch);
// Output the results
header('Content-Type: application/json');
echo $result;
exit;
/*echo 'Nothing posted to this script.';
exit;*/
?>
这不能给我正确的结果。但是,当我检查visenze仪表板时,我得到了正确的结果。我想在形成请求时fq参数有问题。