473,395 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

php code that checks whether a url exist

4
pls i try writing out this code to check whether a url exist or not, but it just won't work.each time i click to submit the url, it keeping saying file not readable.
below are the codes pls check and see how you can help.

<body>
<?php

if ($_GET[url] != "") {
$result = 1;
if (! ereg("^https?://",$_GET[url])) {
$status = "This demo requires a fully qualified http:// URL";
} else {
if (@fopen($_GET[url],"r")) {
$status = "This URL s readable";
} else {
$status = "This URL is not readable";
}
}
} else {
$result = 0;
$status = "no URL entered (yet)";
}

?>

<body bgcolor="white"><table width="600" align="center" bgcolor="#CC9900">
<tr><td>

<div align="center">
<?php
if ($result != 0) {
print "Checking URL <b>".htmlspecialchars($_REQUEST[url])."</b><br />";
}
print "$status";
?>
<br />

Please enter a URL(existance check):
</div>
<form>
<div align="center">The URL:
<input name="url" size=50/>
<br />
<input type="submit" />
</div>
</form>



</td></tr></table>
</body>
Apr 1 '08 #1
1 1295
TheServant
1,168 Expert 1GB
First thing I see is that it has to be $_GET['url'], not $GET[url].

Never used $_GET['url'] function, but a quick google search revealed that if you don't use urldecode($_GET['url']); you could have some issues with any information in the URL (GET values).

Try those and see how it goes.
Apr 1 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

22
by: Martin MOKREJ© | last post by:
Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: cat somefile.py a = 222 b = 111 c = 9
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
8
by: G Patel | last post by:
I wrote the following program to remove C89 type comments from stdin and send it to stdout (as per exercise in K&R2) and it works but I was hoping more experienced programmer would critique the...
5
by: Alan Roberts | last post by:
Is it possible to have conditional references and code execution in csharp? I have an app that plays Windows Media asx streams. It requires WMP 9+ to be installed for this to work and so this is a...
3
by: Christer | last post by:
Hi all! We're creating an administration for a web application. This includes severeal aspx pages. Our key entity in the web application is "Profile", which can have a certain type. Based on...
3
by: Kermit Piper | last post by:
Hello everyone, OK, let me try and explain again please. Here is what I'm trying to do. I have a 12-digit (UPC-A) javascript validation script which works great. All I need now is a similar...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
0
by: peridian | last post by:
Hi, I have the below code to transfer code modules between Access database files. I have three problems, only one of which is annoying. a) How do you prevent the Save As box from appearing...
1
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= | last post by:
On reflection, you could possibly make the app a self extracting zip file which extracts the EXE and a settings file and then starts the app, then when you app closes, it can repack the settings...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.