卷曲没有回复任何回复

时间:2013-10-11 11:27:31

标签: php curl

我正在使用curl从不同服务器上的文件中获取响应..

卷曲代码:

$url="http://example.com/trck.php?adrs=yy";
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);

curl_close($ch);
return $result;

trck.php代码:

$url=mysqli_real_escape_string($link,$_GET['adrs']);
$sql="SELECT * FROM product where site = '$url'";
$res=mysqli_query($link,$sql) or die( mysqli_error() );
$row=mysqli_fetch_assoc($res);
if(mysqli_num_rows($res)==0 || $row['status']==0)
{
return no;

}
else
{
return yes;
}

但是没有回应。

帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

$url=mysqli_real_escape_string($link,$_GET['adrs']);
$sql="SELECT * FROM product where site = '$url'";
$res=mysqli_query($link,$sql) or die( mysqli_error() );
$row=mysqli_fetch_assoc($res);
if(mysqli_num_rows($res)==0 || $row['status']==0)
{
echo 'no';
}
else
{
echo 'yes';
}

也:

$url="http://example.com/trck.php?adrs=yy";
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);

curl_close($ch);
echo $result;

你必须回复curl返回的转移。