php 中 curl_setopt 问题,模拟提交网站

<?php

$url = "http://www.directoryws.com/submit.php";

$data = array();
$data['LINK_TYPE'] ="free";
$data['TITLE'] ="isreanod";
$data['URL'] ="http://www.baidu.com";
$data['DESCRIPTION'] ="uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuiii";
$data['OWNER_NAME'] ="reanod";
$data['OWNER_EMAIL'] ="10000000000@126.com";
$data['CATEGORY_ID'] ="2";
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

// 自动跟随跳转
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);

$return = curl_exec($ch);// 执行操作
if (curl_errno($ch)) {
echo 'Errno'.curl_error($ch);//捕抓异常
}
curl_close($ch); // 关闭CURL会话

var_dump($return);// 返回数据

为啥就是不成功呢???

1个回答

php的curl模块开启了吗?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐