My Project: Trying to store text found in a forum.
Posted: Fri Feb 24, 2006 8:32 pm
First you log into the site.
Once logged in, you can view posts.
In my signature, I have a script that runs. I want my script to save to my database the user's name who is viewing my post.
When you view the source of the post there is a line that has the user's id in it.
I want to store the whole entire page into a varable then seach for the user's id and insert it into my database, along with a time stamp, plus more to come.
This is what I have so far.
And of course, I am new to PHP and none of this works.
Once logged in, you can view posts.
In my signature, I have a script that runs. I want my script to save to my database the user's name who is viewing my post.
When you view the source of the post there is a line that has the user's id in it.
I want to store the whole entire page into a varable then seach for the user's id and insert it into my database, along with a time stamp, plus more to come.
This is what I have so far.
Code: Select all
<?php
$ch = curl_init();
$timeout = 10;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);
$data = file($contents);
$length = count($data);
for ($i=0; $i<$length; $i++)
{
$tempString = $data[$i];
$point1 = strpos($tempString, "up_UserID");
$strpoint2 = "', '";
if ($point1 > 0)
{
$point2 = strpos($tempString, $strpoint2);
$ttest = substr($tempString, $point1+14, ($point2-$point1)-14);
}
}
$username="hidden";
$password="hidden";
$database="hidden";
$connection = mysql_connect("hidden",$username,$password);
mysql_select_db("hidden",$connection);
$query = "insert into temp set ID=" . $ttest;
echo $query;
$result=mysql_query($query);
echo $contents;
?>