I have an on line project "question of the week"; this project allows the users to submit their questions. These questions are saved in a mysql table; the question is also sent over to another simplepost.php which stores the question in a phpBB. I want to use this phpBB for every question, for discussions on that question.
So now, my project stores the question in sql table as well as posts the question in the phpBB.
But when the question is posted in phpBB it stores in it "http://servername.com/phpBB3/viewtopic.php?f=5&t=24" where t=24 is the question.
I somehow want to grab this url and extract the t=24, so that I can have a click able link for each question in my project that directs the question of its particular phpBB page.
Suppose my project is on: http://servername.com/qotw/profile.html (this allows the user to post a question and the question is inserted in sql table and also calls in phpBB/simplepost.php is posts the question in phpBB)
and this question in php can be seen on : "http://servername.com/phpBB3/viewtopic.php?f=5&t=24"
Please suggest to me what should I do. how can I grab this "t=24" from this url.
When my simplepost.php is called, is posts the question using posting.php and a return value is sent back.
The code in simplepost.php looks like:
$title = "This is the title of the message.";
//$body = "This is the message body.";
$post_fields = array(
'subject' => $title,
'addbbcode20' => 100,
'message' => $body,
'lastclick' => $lclick[0],
'post' => 'Submit',
'attach_sig' => 'on',
'creation_time' => $lclick[0],
'form_token' => $security123[1],
'filecomment' => '',
);
//Wait (you might also do this by setting lastclick in the past by 3 seconds
sleep(3);
//Set up curl session for posting the message
$ch1 = curl_init();
curl_setopt($ch1, CURLOPT_URL,$purl);
curl_setopt($ch1, CURLOPT_POST, true);
curl_setopt($ch1, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch1, CURLOPT_HEADER, false );
curl_setopt($ch1, CURLOPT_COOKIE,'cookie.txt');
curl_setopt($ch1, CURLOPT_COOKIEJAR,'cookie.txt');
curl_setopt($ch1, CURLOPT_COOKIEFILE,'cookie.txt');
$result2= curl_exec ($ch1);
//$result3= curl_exec ($ch1, CURLOPT_URL,$purl);
curl_close ($ch1);
echo $result2;
The respond come in $result2. and the pages goes over to http://servername.com/phpBB3/viewtopic.php?f=5&t=24".
But the thing is all this is happening in the back end. My project does not shows the viewtopic.php page of the phpBB.