![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Jun 2002
Location: france
Posts: 996
|
![]() i want open an web addresse using the php function $x=file($url) ..
here is the problem: if the $url address don't exist then i get an Warning error: "php_network_getaddresses: getaddrinfo failed" in a such case i don't want the warning error to be displayed.. i just want to display a message like "can't access url" i've tryed next code: $x=file($siteurl) or die("Can't access $url"); but first i get the warning error and after that my message... anybody have an ideea how can i make to display just my message in the case that the $url don't exist? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2003
Location: Canby, OR
Posts: 7,453
|
if(!$x = fopen($url)) {
echo "Can not access $url"; exit; } Try that! ![]() ![]() jDOG
__________________
NSCash now powering ReelProfits.com ALSO FEATURING: NSCash.com :: SoloDollars.com :: ReelProfits.com :: BiminiBucks.com :: VOD PROGRAMS COMING SOON: Greedy Bucks :: Vengeance Cash NOW OFFERING OVER 60 SITES CONTACT :: JAMES SMITH :: CHIEF TECHNOLOGY OFFICER :: ICQ (711385133) |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 | |
Confirmed User
Join Date: Jun 2002
Location: france
Posts: 996
|
Quote:
Warning: Wrong parameter count for fopen() in /home/****** on line 23 Can not access http://www.******** |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
Quote:
fopen($url, "r") would be the correct syntax. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
Confirmed User
Join Date: Feb 2003
Location: Canby, OR
Posts: 7,453
|
Quote:
jDOG
__________________
NSCash now powering ReelProfits.com ALSO FEATURING: NSCash.com :: SoloDollars.com :: ReelProfits.com :: BiminiBucks.com :: VOD PROGRAMS COMING SOON: Greedy Bucks :: Vengeance Cash NOW OFFERING OVER 60 SITES CONTACT :: JAMES SMITH :: CHIEF TECHNOLOGY OFFICER :: ICQ (711385133) |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Nov 2003
Posts: 4,292
|
$fd=fopen("http://www.url.com","r");
while ($line=fgets($fd,1000)) { $alltext.=$line; } fclose ($fd); reads it into $alltext |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Confirmed User
Join Date: Jun 2002
Location: france
Posts: 996
|
Quote:
Warning: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/********* Warning: fopen("http://www.aaaa.aa", "r") - Bad file descriptor in /home/************* Can not access http://www.aaaa.aa ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
If you only wanna suppress the PHP error messages (which is good on a live website). Add this to the top of your page:
ini_set("display_errors", 0); |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
Confirmed User
Join Date: Jun 2002
Location: france
Posts: 996
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
...or add an @ in front of the fopen()
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Nov 2003
Posts: 4,292
|
preceed the function with an @
that will stop the warnings like @fopen() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
What it will look like:
$x = @file($siteurl); if ($x) { ..... } else { print "Could not connect to $url"; exit; } |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Join Date: Jun 2002
Location: france
Posts: 996
|
ok.. @file() works fine.. thanks to everybody
|
![]() |
![]() ![]() ![]() ![]() ![]() |