PHP functions

Status
Not open for further replies.

Mike

New member
Jun 27, 2006
6,777
116
0
51
On the firing line
This is baffling to me. When I write a function, and call it, I get an error. BUT, if I just copy the damn thing and paste into the script I want to use it in, it works fine.

I have
Code:
include ("includes/functions.php");

at the start of my script, then the function name where I want to use it. The errors I'm getting are on the functions.php script page.

Code:
[B]Warning[/B]:  ftp_connect() [[URL="http://www.halfmoononline.com/function.ftp-connect"]function.ftp-connect[/URL]]: php_network_getaddresses: getaddrinfo failed: Name or service not known in [B]/home/xxxxxxx/public_html/halfmoononline/includes/functions.php[/B] on line [B]66[/B]
Couldn't connect to

Any ideas?
 


My brain is a little fried today, but me let me make sure I have this right. You can't call any functions from include files?
 
are you sure you are calling the right file?

Also: One of my servers was being a cunt with capitals the other day.

::emp::
 
Name or service not known in /home/xxxxxxx/public_html/halfmoononline/includes/functions.php on line 66

Prob a DNS issue... change the call there from yourdomainname.com to the IP or the server/site.
 
Yeah, calling the right file. And using the correct function name. All I did different was C&P the code from the function into the page I wanted to use it on.

I'm confuzzled...
 
IP like below...

My guess is you are using $ftp_server ='ftp://domainname.com'; ???

$ftp_server = '200.200.200.200';
$ftp_port = 'port';
$conn_id = ftp_connect($ftp_server,$ftp_port);
 
Okay coolness, makes sense.

Well, turns out, I needed to call the "includes/functions.php" file by entering the full URL. Not sure why that worked, but it did.

Thanks for the help!
 
Status
Not open for further replies.