我需要通过 CURL 和 PHP 在 vbulletin 上发布一个论坛帖子,这似乎不是一项艰巨的工作,但是它必须有图片,而且我可以上传一张图片,但是一旦我添加了第二张图片,它似乎只是重定向到我要发布到的论坛中的顶部线程?
这是我的代码,似乎发布第二张图片只是更改图片的路径..但它不起作用?
$post = array(
'st' => '0',
'act' => 'Post',
's' => '',
'f' => '157',
'auth_key' => $this->scrape->fetchBetween("<input type='hidden' name='auth_key' value='", "'",$this->scrape->result),
'removeattachid' => '0',
'MAX_FILE_SIZE' => '0',
'CODE' => '01',
'post_key' => $this->scrape->fetchBetween("<input type='hidden' name='post_key' value='", "'",$this->scrape->result),
'TopicTitle' => $data['title'],
'TopicDesc' => '',
'tag' => $tag,
'bbmode' => 'normal',
'ffont' => '0',
'fsize' => '0',
'fcolor' => '0',
'LIST' => 'LIST ',
'helpbox' => 'Image (alt + g) [img]http://www.dom.com/img.gif[/img]',
'tagcount' => '',
'Post' => $description,
'enableemo' => 'yes',
'enablesig' => 'yes',
'iconid' => '0',
'FILE_UPLOAD' => "@".$data['img1'],
'attachgo' => 'Add This Attachment'
);
$this->scrape->fetch('http://forum.lowyat.net/index.php?', $username, $post);
if(!empty($data['img2'])) {
$post = array(
'st' => '0',
'act' => 'Post',
's' => '',
'f' => '157',
'auth_key' => $this->scrape->fetchBetween("<input type='hidden' name='auth_key' value='", "'",$this->scrape->result),
'removeattachid' => '0',
'MAX_FILE_SIZE' => '0',
'CODE' => '01',
'post_key' => $this->scrape->fetchBetween("<input type='hidden' name='post_key' value='", "'",$this->scrape->result),
'TopicTitle' => $data['title'],
'TopicDesc' => '',
'tag' => $tag,
'bbmode' => 'normal',
'ffont' => '0',
'fsize' => '0',
'fcolor' => '0',
'LIST' => 'LIST ',
'helpbox' => 'Image (alt + g) [img]http://www.dom.com/img.gif[/img]',
'tagcount' => '',
'Post' => $description,
'enableemo' => 'yes',
'enablesig' => 'yes',
'iconid' => '0',
'FILE_UPLOAD' => "@".$data['img2'],
'attachgo' => 'Add This Attachment');
$this->scrape->fetch('http://forum.lowyat.net/index.php?', $username, $post);
echo "<pre>";
print_r($post);
exit($this->scrape->result);
}
我会很感激任何建议......一定有什么东西藏在某个地方,但我就是看不到它......
谢谢,