Jump to content

Archived

This topic is now archived and is closed to further replies.

Eugene

cURL problem

Recommended Posts

I'm using a modified script posted on http://php.net

[code=php:0]
$topic_title = "title";
$topic_desc = "date";
$post = "post";
$question = "Question.";
$url = "http://";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "act=post&do=new_post&f=84&st=0&auth_key=66538cf7bb52399cba26f33e8984c06b&CODE=01&post_key=14355a276a3807b5c7232e0ab7aa3509&TopicTitle=$topic_title&TopicDesc=$topic_desc&Post=$post&dosubmit=Post New Topic&question_1=$question&choice_0=5&choice_1=4&choice_2=3&choice_3=2&choice_4=1&");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec($ch);
curl_close($ch);
[/code]

The forum uses IPB software. I also tried it with simple forum i made, and it doesnt work. Help with why please?

http://us3.php.net/manual/en/ref.curl.php#57872

Share this post


Link to post
Share on other sites
Should [b]auth_key[/b] and [b]post_key[/b] be generated by the IPB forum?
Maybe they need to be unique.

Also, I think from the above code it will not output anything, CURLOPT_RETURNTRANSFER tells CURL to return the content into a variable so to output the result do this:
[b]echo(curl_exec($ch));[/b] where you have [b]curl_exec($ch);[/b]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.