Page 1 of 1

backlink checker script, worked then stopped??? php 4.2.3

Posted: Sun Sep 16, 2007 9:11 am
by webmasterm
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi i've been working on this backlink script and last night finally got it working fast too!
then all of the sudden this script get stuck in a loop and does nothing???
also the remote variable isn't even found???  is there a setting in the php.ini that i haved
to adjust to make this script work please help a.s.a.p.????

LOST

Code: Select all

<html>
<head>
</head>
<body>
<a href="http://yoururl.com">Yoururl.com</a><br/>
</body>
</html>

<?php
// $requestedurl = parse_url($_SERVER['HTTP_REFERER']);
// $remote = $requestedurl['host'];
// $remote = str_replace('www.', '', $remote);
$link = 'http://yoururl.com';

$remote = 'http://yoururl.com/test.html';
// $siteurl = "http://auctions.shopping.yahoo.com/"; // this is the webpage the backlink should be found on
// $recip = "http://www.yahoo.com/"; // this is the reciprocal url, text, image, ... that EXACTLY must match

if (backlinkCheck($remote, $link)) {
echo "Backlink was FOUND on: ".$remote;
} else {
echo "Backlink was NOT FOUND on: ".$remote;
}

function backlinkCheck($remote, $link) {
	$arrText = file($remote);
	for ($i=0; $i<count($arrText); $i++) {
		$text = $text . $arrText[$i];
	}
	if (eregi($link, $text)) {
		return true; // set true if there is a backlink
	} else {
		return false; // set false if backlink is missing
	}
}

?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Sep 16, 2007 9:18 am
by feyd
Is there a reason you're not using file_get_contents() instead of file() plus the loop?

Also, eregi() is a regular expression function, but the patter you give it isn't designed to be a pattern.


Run the following in a new file and tell us the results please.

Code: Select all

<?php

$neg = array('off', 0, false, '', null);
$flags = array(
	'Register Globals' => 'register_globals',
	'Short Tags' => 'short_open_tag',
	'Display Errors' => 'display_errors',
	'Magic Quotes GPC' => 'magic_quotes_gpc',
	'Magic Quotes Runtime' => 'magic_quotes_runtime',
	'Magic Quotes Sybase' => 'magic_quotes_sybase',
	'Allow URL fopen' => 'allow_url_fopen',
);
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
foreach ($flags as $n => $v)
{
	$flags[$n] = (in_array(strtolower(ini_get($v)), $neg) ? 'Off' : 'On');
}
$flags['Config file'] = get_cfg_var('cfg_file_path');
if (empty($flags['Config file']))
{
	$flags['Config file'] = '-';
}
$cli = (php_sapi_name() == 'cli');
$eol = "\n";

$gle = get_loaded_extensions();
$rows = array();
$le = '';
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
	$le .= '   ' . implode('   ', array_slice($gle, $i, $wide)) . $eol;
}

$ec = array(
	'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
	'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
	'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
	'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);

$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
	if (($t & $v) == $v)
	{
		$e[] = $n;
		$t ^= $v;
	}
}
if (ceil(count($ec) / 2) + 1 < count($e))
{
	$e2 = array();
	foreach ($ec as $n => $v)
	{
		if (!in_array($n, $e) and $n != 'E_ALL')
		{
			$e2[] = $n;
		}
	}
	$er = $er . ' ((E_ALL | E_STRICT) ^ ' . implode(' ^ ', $e2) . '))';
}
else
{
	$er = $er . ' (' . implode(' | ', $e) . ')';
}

if (!$cli)
{
	echo '<html><head><title>quick info</title></head><body><pre>', $eol;
}

echo 'PHP Version: ', $ve, $eol;
echo 'PHP OS: ', $os, $eol;
echo 'Error Reporting: ', $er, $eol;
foreach ($flags as $n => $v)
{
	echo $n, ': ', $v, $eol;
}
echo 'Loaded Extensions:', $eol, $le, $eol;

if (!$cli)
{
	echo '</pre></body></html>', $eol;
}

?>

get nothing with code above???

Posted: Sun Sep 16, 2007 9:21 am
by webmasterm
gets stuck in a constant loop! this is freakin wierd?

Re: get nothing with code above???

Posted: Sun Sep 16, 2007 9:24 am
by feyd
webmasterm wrote:gets stuck in a constant loop! this is freakin wierd?
You get nothing from the code I posted? I find that hard to believe.

alrighty then! this is even more strange!

Posted: Sun Sep 16, 2007 9:26 am
by webmasterm
So i got this odd idea of "hey maybe if i restart the apache server, shut it down then restart it it may work then!"

So guest what! It freakin works now, is there an error in my php settings a timeout issue for running scripts something that would cause this! Never seen this before in my life

BUT THE SCRIPT WORKS PERFECT NOW SINCE I RESTARTED THE APACHE SERVER?????????

SORRY THAT WORKS TOO NOW!!!

Posted: Sun Sep 16, 2007 9:28 am
by webmasterm
since i restarted my apace server the script above you wanted me to try works now too here it is below:




PHP Version: 4.2.3
PHP OS: WINNT
Error Reporting: 2039 ((E_ALL | E_STRICT) ^ E_STRICT ^ E_NOTICE))
Register Globals: Off
Short Tags: On
Display Errors: Off
Magic Quotes GPC: On
Magic Quotes Runtime: Off
Magic Quotes Sybase: Off
Allow URL fopen: On
Config file: C:\WINDOWS\php.ini
Loaded Extensions:
standard bcmath calendar com
ftp mysql odbc pcre
session xml wddx bz2
gd zlib Zend Optimizer apache

Posted: Sun Sep 16, 2007 9:43 am
by feyd
There's nothing in the output of the script I posted that would suggest a specific problem. Although I would suggest you turn off short tags and turn on display errors. This will help with various other things.