ajc40 posted on 2011-02-23 08:13:33 #
Hi I was quite excited when I saw this script, just what I need.
However, it keeps returning a blank page.
I made a test only file called example2.php, here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>PHP Function for Reciprocal Linkback Checking Example</title>
</head>
<body bgcolor="#ffffff">
<p>Both URL's must be valid like: <b>http://www.yourdomain.com/</b> or <b>http://www.somedomain.com/with_page.html</b></p>
<form method="post" action="php_back_link_checker.php" style="margin-top:20px;">
<div>
<label for="remote">Enter a valid target URL (target website) <br /></label>
<input name="remote" type="text" id="remote" value="" size="50" />
</div>
<div>
<label for="my_link">Enter here the URL you want to search inside the html code of the target website<br /></label>
<input name="my_link" type="text" id="my_link" value="" size="50" />
</div>
<div>
<input type="submit" name="Submit" value="Check!" />
</div>
</form>
</body>
</html>
And your php_back_link_checker code:
<?php
function check_back_link($remote_url, $your_link) {
$match_pattern = preg_quote(rtrim($your_link, "/"), "/");
$found = false;
if ($handle = @fopen($remote_url, "r")) {
while (!feof($handle)) {
$part = fread($handle, 1024);
if (preg_match("/<a(.*)rel="nofollow" href=[\"']".$match_pattern.
"(\/?)[\"'](.*)>(.*)<\/a>/", $part)) {
$found = true;
break;
}
}
fclose($handle);
}
return $found;
}
if (check_back_link("http://www.all4yourwebsite.com", "http://www.finalwebsites.com")) echo "link exists";
?>
Fopen is enabled on my server so thats not the problem, I'm new to php but I really need to get your script working on my site.
Any ideas as to what I've done wrong?
The most popular forum posts:
Comments / discussions
Olaf posted on 2011-02-23 08:35:00 #
Hello and welcome...
Remove the "@" symbol in front of the "fopen" function, what error do you get?
ajc40 posted on 2011-02-23 09:08:58 #
Thanks, good to be here".
Did that and there's no error, still a blank page.
Olaf posted on 2011-02-23 09:14:56 #
Hi,
do you know how-to use the phpinfo() function?
is this directive enabled? allow_url_fopen On
ajc40 posted on 2011-02-23 09:31:40 #
Olaf posted on 2011-02-23 09:46:02 #
Okay than it's maybe something else (I hate these white screens)
The problem is that we need to track down the problem, in most of the times error_reporting will help. Please check this article about php debugging.
ajc40 posted on 2011-02-25 06:18:04 #
hi,
thanks for the article about php debugging.
Thing is, I wanna use the linkback checker function as a standalone script like
what you have on the function demo page http://www.finalwebsites.com/demos/php_back_link_checker.php
Once I can get it working like on your demo page, then I'll do a little customization.
To get it working like on your demo page, what additional code/script do I need?
Olaf posted on 2011-02-25 10:43:51 #
Hi,
I'm using this code together with that function/snippet:
$found_link_txt = " ";
if (isset($_POST['Submit'])) {
if (empty($_POST['remote']) || empty($_POST['my_link'])) {
$found_link_txt = "<b>Both fields must be entered to test this script.</b>";
} else {
if (check_back_link($_POST['remote'], $_POST['my_link'])) {
$found = "EXISTS";
} else {
$found = "DOES NOT EXIST";
}
$found_link_txt = "The link \"".$_POST['my_link']."\" <b>".$found."</b> on \"".$_POST['remote']."\"";
}
}
Does the function work for now? What was the problem you've faced before?
ajc40 posted on 2011-02-27 06:20:42 #
Thanks Olaf, but it's still returning a blank page.
I added your code above to the php_back_link_checker.php code
so it now reads:
<?php
function check_back_link($remote_url, $your_link) {
$match_pattern = preg_quote(rtrim($your_link, "/"), "/");
$found = false;
if ($handle = @fopen($remote_url, "r")) {
while (!feof($handle)) {
$part = fread($handle, 1024);
if (preg_match("/<a(.*)rel="nofollow" href=[\"']".$match_pattern.
"(\/?)[\"'](.*)>(.*)<\/a>/", $part)) {
$found = true;
break;
}
}
fclose($handle);
}
return $found;
$found_link_txt = " ";
if (isset($_POST['Submit'])) {
if (empty($_POST['remote']) || empty($_POST['my_link'])) {
$found_link_txt = "<b>Both fields must be entered to test this script.</b>";
} else {
if (check_back_link($_POST['remote'], $_POST['my_link'])) {
$found = "EXISTS";
} else {
$found = "DOES NOT EXIST";
}
$found_link_txt = "The link \"".$_POST['my_link']."\" <b>".$found."</b> on \"".$_POST['remote']."\"";
}
}
?>
I'm using the code below on a html page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>PHP Function for Reciprocal Linkback Checking Example</title>
</head>
<body bgcolor="#ffffff">
<p>Both URL's must be valid like: <b>http://www.yourdomain.com/</b> or <b>http://www.somedomain.com/with_page.html</b></p>
<form method="post" action="php_back_link_checker.php" style="margin-top:20px;">
<div>
<label for="remote">Enter a valid target URL (target website) <br /></label>
<input name="remote" type="text" id="remote" value="" size="50" />
</div>
<div>
<label for="my_link">Enter here the URL you want to search inside the html code of the target website<br /></label>
<input name="my_link" type="text" id="my_link" value="" size="50" />
</div>
<div>
<input type="submit" name="Submit" value="Check!" />
</div>
</form>
</body>
</html>
You'd think it would be working.
Tried putting php_value display_errors 1
php_value error_reporting E_ALL in .htaccess file but still displays a blank
page when I test the script.
Olaf posted on 2011-02-27 13:26:15 #
Please create a phpinfo() file and send me the URL (use the personal messaging function)
ajc40 posted on 2011-02-28 13:25:00 #
hi, where's the PM function? Can't see it anywhere.
Olaf posted on 2011-02-28 15:41:36 #
Quote from: ajc40
"hi, where's the PM function? Can't see it anywhere."
Yes it's unique for bbpress :)
right below my avatar/forum title
ajc40 posted on 2011-03-01 09:31:01 #
I searched for it in your profile and everywhere else and still no luck.
The only place I saw it is in the Source Code for this page.
testuser posted on 2011-03-01 15:21:18 #
Quote from: ajc40
"I searched for it in your profile and everywhere else and still no luck.
The only place I saw it is in the Source Code for this page."
Click "View your profile" and than "Edit". Look for the section "Send and receive e-mail messages from other members" and activate that checkbox.
ajc40 posted on 2011-03-02 09:25:00 #
Ahhh there we go, thanks for that testuser".
Olaf posted on 2011-03-02 21:12:20 #
Quote from: ajc40
"Ahhh there we go, thanks for that testuser"."
do you send me some message?
ajc40 posted on 2011-03-03 05:46:16 #
I replied to your email, but I'll send a PM as well now.
Olaf posted on 2011-03-18 07:43:01 #
Quote from: ajc40
"I replied to your email, but I'll send a PM as well now."
Seems to be that the PM function has some issues :(
Do you send a message to email address I use for the forum registrations and notifications?
You can use also contact @