0

我正在使用 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;
}

但没有任何回应。

帮助将不胜感激。

4

1 回答 1

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 返回的传输。

于 2013-10-11T11:29:34.210 回答