Only thing I found on web is Snoopy, and I dont know how to use it ..
Here is the thing:
I need some data from other page. I have link, that is uniqe for all users, so on that other page there is nick of that user.
So I check for username: fetchtext ....
Code:
if($_POST[link]){
$link=$_POST['link'];
include_once "snoopy.class.php";
$snoopy = new Snoopy;
$snoopy->fetchtext("$link");
$result = $snoopy->results;
$find = "Text before nick "; //this works
$pos = strpos($result,$find);
$pos2 = $pos + x; //x is number of places after text, just before nick
$indexer = 0;
while($result[$pos2] !='<')
{
$imeui[$indexer] = $result[$pos2];
$indexer++;
$pos2++;
}
$nick = implode('',$imeui);
$nick = trim($nick);
echo "Your nick is: ";
print($nick);
}
Sometimes I GET:
1. "Your nick is: Kova" (THIS IS OK)
2. "Your nick is Kova Username: Email: Password:" (how to AVOID THIS)
Anybody can help with fetching link on that other page (that I am linked too), I dont know how to use fetchlink....
link is something like: "<a href=http://www.htmlforums.com/archive/index.php/"stats.php?id=NUMBER I NEED">"
Please respond to whole message not part, thanks..Can your usernames have spaces? If not, you could just do a preg_split on the string, and split it on the spaces...then just take the fist thing that it returns...like this:$nick = preg_split('/ /', $nick, 1, PREG_SPLIT_NO_EMPTY);
$nick = $nick[0];
Preg Split would take "Kova Username: Email: Password:" and split it into an array like this:Array
(
[0] => Kova
[1] => Username:
[2] => Email:
[3] => Password:
)
Then the red 1 is a limit and so it will only worry about returning the 1st element that it finds (not particularly important, but there is no reason to look at things you don't need). So the array would look like this:Array
(
[0] => Kova
)
Then you just use that...$nick[0]
IF you DO allow spaces in user names, you'd have to look at another way.That should do it, Ill try it and tell you, I dont use spaces in nicks ...
So it should work, thanks ...
But I need to solve how to pull out link that I want..Thanks, it works !Guys I still have 1 little problem...
I get nick, thats ok, but on end of it there is space..
And trim doesnt remove it ..
What to do ..
$nick = implode('',$imeui);
$nick = preg_split('/ /', $nick, 1, PREG_SPLIT_NO_EMPTY);
$nick = $nick[0];
$nick = trim($nick);
And I get Kova_ // "_" is space
Here is the thing:
I need some data from other page. I have link, that is uniqe for all users, so on that other page there is nick of that user.
So I check for username: fetchtext ....
Code:
if($_POST[link]){
$link=$_POST['link'];
include_once "snoopy.class.php";
$snoopy = new Snoopy;
$snoopy->fetchtext("$link");
$result = $snoopy->results;
$find = "Text before nick "; //this works
$pos = strpos($result,$find);
$pos2 = $pos + x; //x is number of places after text, just before nick
$indexer = 0;
while($result[$pos2] !='<')
{
$imeui[$indexer] = $result[$pos2];
$indexer++;
$pos2++;
}
$nick = implode('',$imeui);
$nick = trim($nick);
echo "Your nick is: ";
print($nick);
}
Sometimes I GET:
1. "Your nick is: Kova" (THIS IS OK)
2. "Your nick is Kova Username: Email: Password:" (how to AVOID THIS)
Anybody can help with fetching link on that other page (that I am linked too), I dont know how to use fetchlink....
link is something like: "<a href=http://www.htmlforums.com/archive/index.php/"stats.php?id=NUMBER I NEED">"
Please respond to whole message not part, thanks..Can your usernames have spaces? If not, you could just do a preg_split on the string, and split it on the spaces...then just take the fist thing that it returns...like this:$nick = preg_split('/ /', $nick, 1, PREG_SPLIT_NO_EMPTY);
$nick = $nick[0];
Preg Split would take "Kova Username: Email: Password:" and split it into an array like this:Array
(
[0] => Kova
[1] => Username:
[2] => Email:
[3] => Password:
)
Then the red 1 is a limit and so it will only worry about returning the 1st element that it finds (not particularly important, but there is no reason to look at things you don't need). So the array would look like this:Array
(
[0] => Kova
)
Then you just use that...$nick[0]
IF you DO allow spaces in user names, you'd have to look at another way.That should do it, Ill try it and tell you, I dont use spaces in nicks ...
So it should work, thanks ...
But I need to solve how to pull out link that I want..Thanks, it works !Guys I still have 1 little problem...
I get nick, thats ok, but on end of it there is space..
And trim doesnt remove it ..
What to do ..
$nick = implode('',$imeui);
$nick = preg_split('/ /', $nick, 1, PREG_SPLIT_NO_EMPTY);
$nick = $nick[0];
$nick = trim($nick);
And I get Kova_ // "_" is space