Report a dead link - HOW?
06-05-2008, 12:09 PM
|
Report a dead link - HOW?
|
Posts: 129
|
Hi guys,
I want to create a little feature that says "Report Dead Link". After clicking this I want to notified that this particular link is broken. Obviously, I am talking about videos but it would be nice if it worked on anything.
I am guessing a little bit that it is PHP. But, I am not totally sure. It may even be done by JavaScript but PHP would be preferred for more usability for everyone.
Thank you guys, much appreciated.
|
|
|
|
06-05-2008, 03:56 PM
|
Re: Report a dead link - HOW?
|
Posts: 11
Name: Ben
Location: Midwest - United States
|
Do you currently have custom error pages? 404, 500, etc..
__________________
TextAdMarket - Please login or register to view this content. Registration is FREE
Supply & Demand Advertising
|
|
|
|
06-05-2008, 05:59 PM
|
Re: Report a dead link - HOW?
|
Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
|
Is this links insite or links out of site? You can look through your error log for missing pages. If it's links out of your site that's different and offers many ways you can do it, from email to a database to a text file.
__________________
PHP Code:
<?php echo "Hello World"; ?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
|
|
|
|
06-06-2008, 04:48 AM
|
Re: Report a dead link - HOW?
|
Posts: 129
|
I don't currently have custom error pages. BUT, I am moving hosts soon, where I will create them (404, 500 etc.)
The links will be like videos embedded from youtube. Obviously, these links may die. I wanted a button that people would click on which would tell me the exact video that is broken. (I will have loads and loads of videos so ID is important).
Thank you guys.
|
|
|
|
06-06-2008, 05:21 PM
|
Re: Report a dead link - HOW?
|
Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
|
Do the videos already have IDs? Also do you want this to be put into a SQL database, emailed to you, put into a text file?
__________________
PHP Code:
<?php echo "Hello World"; ?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
|
|
|
|
06-06-2008, 05:33 PM
|
Re: Report a dead link - HOW?
|
Posts: 129
|
To be honest, I am nowhere near an expert on databases. My idea/aim is to add a unique ID to each link. Then, if the button next to it is clicked on (report), I want to be emailed that which exact file is broken.
OK guys, to make it a little easier, here is a example code (link) from another site that has the exact feature.
domain.com/report.php?a=report&w=1&plinkid=108970
I don't know if it helps but I have an idea that PHP coding is needed. Also, unique ID's.
Sorry I can't help more.
|
|
|
|
06-06-2008, 06:08 PM
|
Re: Report a dead link - HOW?
|
Posts: 843
Name: Mike
Location: United Kingdom
|
If you want a Unique ID for each row in the table, you need to make sure it is there when you add the link data table structure. Here is the MySQL needed to make the table I think you have in mind:
Code:
CREATE TABLE IF NOT EXISTS `exampletable` (`ID` INT NOT NULL AUTO_INCREMENT ,
`Linkname` varchar(255) NOT NULL,
`linkURL` varchar(255) NOT NULL,
`linkinfo` varchar(255) NOT NULL,
`reportdeadnumb` varchar(255) NOT NULL,
PRIMARY KEY ( `id` ) )
In the above, the field ID, will increase by one per each row added.
After you have created a MySQL database with that, make a cron that emails you (via the mail() function) when the count gets above a certain number (in case someone marks all the links as dead).
If you don't like using database, use the following code on a page (Adapted from http://uk.php.net/manual/en/function.mail.php ).
PHP Code:
<?php $to = 'wez@example.com';
// subject $subject = 'Link:'.$_GET['linkname'].' is down';
// message $message = ' <html> <head> <title>Link:'.$_GET['linkname'].' is down</title> </head> <body> <p>Link:'.$_GET['linkname'].' is down</p> <p>URL:'.$_GET['linkurl'].'</p </body> </html> ';
// To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers $headers .= 'To: Mary <mary@example.com>' . "\r\n"; $headers .= 'From: Deadlink Reminder <birthday@example.com>' . "\r\n";
// Mail it mail($to, $subject, $message, $headers);
# The above is a tad insecure. ?>
For this, say the user was looking at the page with url: file.php?linkname=Your Crazy Link Name&linkurl=http://example.com/
the email would read:
Code:
Link: Your Crazy Link Name
URL: http://example.com/
Useful links:
http://www.php.net/ - This is the PHP homepage (I think), it's got some great resources (not to mention a great manual) for PHP.
__________________
My Blog/Site: Please login or register to view this content. Registration is FREE
Last edited by rogem002; 06-06-2008 at 06:21 PM..
|
|
|
|
06-06-2008, 09:43 PM
|
Re: Report a dead link - HOW?
|
Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
|
You don't need unique IDs; the videos already have them. You'd watch it on their site at http://youtube.com/watch?v=kQL9V2dnKFY, and kQL9V2dnKFY is the unique ID of that video. If you use the html snippet they give you to embed the video, the code has that same ID in it, telling their system what video to fetch and send down.
So, you need a couple of things, but one of them is taken care of for you. You also need some resting place for your reports to go when somebody files one. A database is your best option, but you could work something else out, like writing to a text or xml file. Then you need a page, you might call it report.php, with some coding to accept parameters ( like the ID ) and write to the database. Instead of having it email you, or maybe in addition, it could also display a report.
How many videos do you plan to 'have?' Another option that might be better overall, is to use a robot, or a spider. It can go through your site, try to load each video, and then it can flag them when one stops working. The advantage here is that you'll know about it before any user does, giving you some time to be proactive.
|
|
|
|
06-07-2008, 01:13 AM
|
Re: Report a dead link - HOW?
|
Posts: 10
|
Hi,
If you're using linux you can also run a System Command like this:
Quote:
<?php
$result = exec("ping http://www.mylink.com");
if($result...){
echo "Link Working";
}else{
echo "Link Down";
}
?>
|
|
|
|
|
06-07-2008, 04:28 AM
|
Re: Report a dead link - HOW?
|
Posts: 6,521
Name: Dan
Location: Swindon
|
That is no way the best way to do this.
Surly if you wanted to be clever just have a cron which crawls your site and checks all your links.
But to be quite frank you have said you dont really know PHP so what are you asking?! or are you expecting someone to do it for you?
__________________
Discounted Web Hosting With XDnet! >> Get 25% of hosting~ Promo: Webmaster-talk <<
|
|
|
|
06-07-2008, 08:07 AM
|
Re: Report a dead link - HOW?
|
Posts: 189
|
Quote:
Originally Posted by ForrestCroce
You don't need unique IDs; the videos already have them. You'd watch it on their site at http://youtube.com/watch?v=kQL9V2dnKFY, and kQL9V2dnKFY is the unique ID of that video. If you use the html snippet they give you to embed the video, the code has that same ID in it, telling their system what video to fetch and send down.
So, you need a couple of things, but one of them is taken care of for you. You also need some resting place for your reports to go when somebody files one. A database is your best option, but you could work something else out, like writing to a text or xml file. Then you need a page, you might call it report.php, with some coding to accept parameters ( like the ID ) and write to the database. Instead of having it email you, or maybe in addition, it could also display a report.
How many videos do you plan to 'have?' Another option that might be better overall, is to use a robot, or a spider. It can go through your site, try to load each video, and then it can flag them when one stops working. The advantage here is that you'll know about it before any user does, giving you some time to be proactive.
|
i also want to do something along thoose lines. Can a robot/spider by set so if it finds a certinain string of text it tells me about it. (there will be arround 3 strings of text that it needs to find.) if so how?
(I have all the urls in a mysql database and I dont want it to find new ones.)
Last edited by simster; 06-07-2008 at 08:10 AM..
|
|
|
|
06-07-2008, 01:20 PM
|
Re: Report a dead link - HOW?
|
Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
|
What's your website, give us an example of your setup and then you may get some better help, our crystal balls are affected by the season.
__________________
PHP Code:
<?php echo "Hello World"; ?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
|
|
|
|
06-07-2008, 06:03 PM
|
Re: Report a dead link - HOW?
|
Posts: 189
|
http://fluff.jolyza.com/
and here is part of my database.
Code:
INSERT INTO `pets` VALUES('1919149', 'Pengi-san', '4', 'pingu');
INSERT INTO `pets` VALUES('2030410', 'Lechon Baboy', '1', 'piggu');
INSERT INTO `pets` VALUES('2045288', 'Chubba', '3', 'mouseu');
|
|
|
|
06-07-2008, 08:54 PM
|
Re: Report a dead link - HOW?
|
Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
|
http://www.arenlor.com/deadlink/
Created that, if you have any questions feel free to ask.
__________________
PHP Code:
<?php echo "Hello World"; ?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
|
|
|
|
06-08-2008, 05:53 AM
|
Re: Report a dead link - HOW?
|
Posts: 843
Name: Mike
Location: United Kingdom
|
Quote:
Originally Posted by Arenlor
|
I swear that counts as plagiarism because you did not tell us you would publish our work somewhere else, with no credit given 
__________________
My Blog/Site: Please login or register to view this content. Registration is FREE
|
|
|
|
06-08-2008, 01:34 PM
|
Re: Report a dead link - HOW?
|
Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
|
I didn't use anyone's code, I wrote it up myself. Are you claiming my work as your own?
__________________
PHP Code:
<?php echo "Hello World"; ?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
|
|
|
|
|
« Reply to Report a dead link - HOW?
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|