Google Answers Logo
View Question
 
Q: php script working - need help? ( No Answer,   0 Comments )
Question  
Subject: php script working - need help?
Category: Computers > Programming
Asked by: suncell-ga
List Price: $2.00
Posted: 21 Nov 2002 03:34 PST
Expires: 27 Nov 2002 12:07 PST
Question ID: 111843
I downloaded a free script from: http://www.obleam.com/yahoo/
this is suppose to check for expired domains still located in the
directory of Yahoo. I have tried several chmod permissions (755, 644,
777) with only errors.

The script is setup at the following page:
http://www.sun-cell.com/yahoo/yahoo.php


yahoo.php:
<?
//////////////////////////////////////////////
//    YAHOO! Expired Domain Finder v1.0     //
//      http://www.obleam.com/yahoo/        //
//////////////////////////////////////////////
?>
<html>
<head>
 <title>Yahoo Expired Domain Finder</title>
</head>
<body bgcolor="#ffffff">
<font face="courier new, arial" size="2">
<?
if (!$action) {
?>
<center>
<table border="0" cellspacing="4" cellpadding="5">
 <form action="yahoo.php" method="get">
 <input type="hidden" name="action" value="gather">
 <tr>
  <td bgcolor="#777777" align="center" colspan="2"><font
face="verdana, arial" size="2" color="#ffffff"><b>Yahoo! Expired
Domain Finder</b></font></td>
 </tr>
 <tr>
  <td><font face="verdana, arial" size="2">Yahoo! Category
URL:</font><br>
   <input type="text" name="url" size="70"
value="http://dir.yahoo.com/Entertainment/Music/Lyrics/"></td>
 </tr>
 <tr>
  <td colspan="2"><font face="verdana, arial" size="2">Check</font>
<input type="text" name="pp" value="10" size="2"> <font face="verdana,
arial" size="2">domains at once.<br>
  <font size="1">(Setting this too high might cause timeouts and/or
excessive resource usage.)</font>&nbsp;</font></td>
 </tr>
 <tr>
 <td align="center"><br><input type="submit" value="check now!"></td>
 </tr>
 </form>
</table>
</center>
<?
}
elseif ($action == "gather") {
    $page = file($url);
    $news = implode("", $page);
    preg_match_all("/srd\.yahoo\.com\/drst\/(.+?)\/\*http\:\/\/(.+?)\.(com|net|org)(\"|\/)/i",
$news, $string, PREG_PATTERN_ORDER);

    $db = fopen("db.txt", "w");
	$n = 0;
    while (list(,$match) = each($string[2])) {
		$parts = preg_split("/\./", $string[2][$n]);
		$num = count($parts) - 1;		
		$tocheck = $parts[$num].".".$string[3][$n];
		if ($domains[$tocheck] != "yes") {
			fputs ($db, "$tocheck\n");
			$domains[$tocheck] = "yes";
		}
		$n++;
	}
	fclose($db);
?>
<html>
<head>
<meta http-equiv="refresh"
content="0;url=yahoo.php?action=check&pp=<?echo $pp?>&new=1">
</head>
<body>
Gathering domains.<p>Please wait...
</body>
</html>
<?
}
elseif ($action == "showresults") {
?>
<center>
<table border="0" cellspacing="1" cellpadding="7">
 <tr>
  <td><font face="verdana, arial" size="1"><b>Domain</b></font></td>
  <td align="center"><font face="verdana, arial"
size="1"><b>Status</b></font></td>
 </tr>
<?
		$db = file("ndb.txt");
		$n = 0;
		while (list(,$d) = each($db)) {
			$n++;
			if (is_int($n / 2)) { $bg = "#dddddd"; }
			else { $bg = "#eeeeee"; }
			list($domain,$status,$u) = preg_split("/\|/", $d);
?>
 <tr bgcolor="<?echo $bg?>">
  <td><font face="verdana, arial" size="1"><?echo
$domain?></font></td>
  <td align="center"><font face="verdana, arial" size="1"><?echo
$status?></font></td>
 </tr>
<?
		}
?>
</table>
</center>
<?
}
elseif ($action == "check") {
		$db = file("db.txt");
		$total = count($db);
		if ($new == 1) {
			$start = 0;
			$ndb = fopen("ndb.txt", "w");
?>
<p><?echo $total?> domains gathered.</p>
<?
		}
		else { $ndb = fopen("ndb.txt", "a"); }
		$end = $start + $pp - 1;
		if ($end >= ($total-1)) {
			$end = $total - 1;
			$finished = "yes";
		}
		$newstart = $end + 1;
?>
<p>Checking domains <?echo $start+1?> through <?echo $newstart?></p>
<?
		for ($i = $start; $i <= $end; $i++) {
			$tocheck = chop($db[$i]);
			$ptr = fsockopen("whois.nsiregistry.net", 43);
			if ($ptr>0) {
				fputs($ptr, "whois $tocheck\n");
				while(!feof($ptr)) {
					$output=fgets($ptr, 1024);
				}
				if (preg_match("/No match/i", $output)) { $status =
"<b><red>Available</red></b>"; }
				else { $status = "Registered"; }
			}
			else {
				echo "Could not connect to whois server";
				exit;
			}
			fclose($ptr);
		    fputs($ndb, "$tocheck|$status|\n");
		}
		
		if ($finished) {
?>
<meta http-equiv="refresh"
content="0;url=yahoo.php?action=showresults">
<p>Checking process done.<p>Building results page...</p>
<?
		}
		else {
?>
<meta http-equiv="refresh"
content="0;url=yahoo.php?action=check&start=<?echo
$newstart?>&pp=<?echo $pp?>">
<p>Please wait...</p>
<?
		}
		fclose($ndb);
?>
<?
}
?>
</font>
<br><br><br><p align="center"><font face="verdana, arial"
size="1">Powered by <a href="http://www.obleam.com/yahoo/">Yahoo
Expired Domain Finder v1.0</a></font></p>
</body>
</html>

Request for Question Clarification by seizer-ga on 21 Nov 2002 03:36 PST
Do you have shell access? And does the db.txt file already exist?

Clarification of Question by suncell-ga on 21 Nov 2002 04:05 PST
I have created an db.txt file in the yahoo dir. SSH/Telnet shell
access is available.

Request for Question Clarification by seizer-ga on 21 Nov 2002 04:07 PST
Which file(s) have you chmodded, and what values are they currently at?

Clarification of Question by suncell-ga on 21 Nov 2002 05:02 PST
The author requests chmod 777, but I read that 777 or 666 should not
be used and 755 & 644 (chmod u=rwx,go=rx (755)
chmod u=rw,go=r (644)) will work exactly the same.

I have chmod only yahoo.php

Can you get this script to work anywhere else?
Answer  
There is no answer at this time.

The following answer was rejected by the asker (they received a refund for the question).
Subject: Re: php script working - need help?
Answered By: seizer-ga on 21 Nov 2002 05:15 PST
 
Hi there suncell!

The solution is to also chmod the files that the script works with.
Use these commmands, making sure that both the files exist first:

chmod 666 db.txt
chmod 666 ndb.txt

The reason for this is that the webserver runs as the "nobody"
process, so even if you can edit these files while you're logged in,
the webserver can't unless you set these permissions.

Setting yahoo.php to 755 is the correct way.

I hope this sorts things out for you. If anything's unclear, then
please don't hesitate to request clarification before rating this
answer.

Good luck,

--seizer-ga

Request for Answer Clarification by suncell-ga on 21 Nov 2002 06:04 PST
Hello seizer-ga, 

I did this and now nothing happens: messages or errors.

view:
http://www.sun-cell.com/yahoo/yahoo.php

Clarification of Answer by seizer-ga on 21 Nov 2002 06:15 PST
Hi there.

Your script does actually seem to be working now. When I checked it,
it said it found 0 expired domains. The error you were having before
has been fixed.

You may now have to correspond with the person who wrote the script,
in order to receive detailed instructions on how it works.

Good luck,

--seizer-ga

Request for Answer Clarification by suncell-ga on 21 Nov 2002 07:00 PST
Im not sure the script is working as of yet, I noticed that the script
only seems to be checking maybe one url if any??

please help..

Clarification of Answer by seizer-ga on 21 Nov 2002 07:30 PST
Hi there suncell.

The errors which you requested help for, resulted from the fact that
the script wasn't opening, reading, or writing your database text
files. These errors, which popped up as I viewed your page, now seems
to have been resolved by the solution I suggested. When I view the
page, no PHP errors are given.

The question now is of whether your script is doing what you want it
to do - somewhat outside the scope of your original question. If it
isn't providing satisfactory output, my advice to you would be to
contact the author of the script, and ask them whether there are any
further things to set up before the script is fully functional. If
there was a manual supplied with this script, it's probably worth
taking a good look through that as well.

Good luck with this,

--seizer-ga

Request for Answer Clarification by suncell-ga on 21 Nov 2002 09:06 PST
Hello, maybe I was not clear to as the result I was asking and willing
to paying for. I was looking for the services of somebody who was able
to decipher the script and resolve any or all problems. Two dollars is
not very much for this effort so far, but that is what I was willing
to pay.

Your help has been minimal. Ive been messing with the script for
several hours before attempting using Google answers. Switching chmod
and creating text files had been of no resolution before your help
either.

I dont want to have to post this question again.

Clarification of Answer by seizer-ga on 21 Nov 2002 09:27 PST
Hi there suncell.

I'm sorry you're not feeling fully satisfied here. I do find your
assertion that the chmod has been "no help" odd, because after I
helped you with that, the script stopped giving the errors about
fopen() - which I felt resolved your originally expressed query.

You could post a new question here with Google to request more
detailed information about the script's operation, or request
someone's assistance in rewriting it to your particular needs.

If you wish, you may also contact Google themselves. Subject to their
approval, they will grant you a repost or refund:

https://answers.google.com/answers/main?cmd=refundrequest

Sorry I couldn't be of further help to you.

--seizer-ga
Reason this answer was rejected by suncell-ga:
I would like a refund, I did not get the answer I was going after. I
wanted a script (php) to be debugged or help so that I could fix the
problem. The answers which I received were only with regards to the
setup on my hosts server and chom commands. I had been exploring these
commands prior to using the Google answers service and so this was all
for nothing, I will re-ask the request with a better explaination of
what I will need answering>

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy