Jump to content

cURL problem


Eugene

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
Link to comment
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.