473,386 Members | 1,720 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,386 software developers and data experts.

FTP Functions Error

I am using the ftp functions in my project and it is properly run in my local server. but the same script is not working in client server.

My program
Expand|Select|Wrap|Line Numbers
  1.    <?php
  2.  
  3.         $ftp_server="server name";
  4.         $ftp_user="user name";
  5.         $ftp_pass="password";
  6.         $ftp_port=21;
  7.  
  8.         echo "B4 connection";
  9.        // $conn_id=ftp_connect($ftp_server);
  10.         $conn_id=ftp_connect($ftp_server,$ftp_port);
  11.            ....
  12.             ....
  13.            ...
  14.   ?>
  15.  
In this script is running upto the echo statement only not comes to the $conn_id definition line. But this script is successfully run and connect to another server. I also try to use with port number assigning to this script. That time too not working.Anybody know about the reason?Please help me.


Thanks
M.Thalavai
Dec 7 '07 #1
4 1356
Markus
6,050 Expert 4TB
im sorry friend, i couldn't make out your problem; you say it's connection, so what is the problem?

Maybe if you posted the full code, or a larger version, we could help a bit more.

thanks, markus.
Dec 7 '07 #2
Thanks markus,Here i given the normal simple ftp connection program through php.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.  $ftp_server="host name";
  4.  $ftp_usr="user name";
  5.  $ftp_pwd="password";
  6.  $ftp_port=21;
  7.  
  8.  echo "Ftpserver :  $ftp_server <br>";
  9. // $conn_id = ftp_connect($ftp_server,$ftp_port) or die("Couldn't connect to $ftp_server"); 
  10. // $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); 
  11. $conn_id = ftp_connect($ftp_server,$ftp_port) or die("Couldn't connect to $ftp_server"); 
  12.  
  13.  $login    = ftp_login($conn_id,$ftp_usr,$ftp_pwd);
  14.  
  15.  if(!$login){
  16.    echo "FTP Server connection has failed"; 
  17.    exit;    }
  18.  else {
  19.    echo "Successful connection"; exit;}
  20.  
  21.  ?>
  22.  
This is my simple script.It is successfully run in my server not run in client server. I dont know about the reason.

Thanks
M.Thalavai






im sorry friend, i couldn't make out your problem; you say it's connection, so what is the problem?

Maybe if you posted the full code, or a larger version, we could help a bit more.

thanks, markus.
Dec 8 '07 #3
Now i am trying ftp functions with assigns the format of server name in $ftp_server as follows

$ftp_Server="ftp:// server name /";

My Sample program
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $ftp_server="ftp://server name";
  4. //$ftp_server="server name";
  5. $ftp_user="user name";
  6. $ftp_pass="password";
  7.  
  8. echo "B4 connection";
  9. $conn_id=ftp_connect($ftp_server);  ///line no: 9
  10. ....
  11. ....
  12. ...
  13. ?>
  14.  
This simple script runs and causes the following error.


Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/content/html/ftp_conn.php on line 9

Couldn't connect to ftp://server name/

Anybody known about the reason?

Thanks
M.Thalavai
Dec 13 '07 #4
pbmods
5,821 Expert 4TB
Heya, M.Thalavai.

Please use CODE tags when posting source code:

[CODE=php]
PHP code goes here.
[/CODE]
Dec 23 '07 #5

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

Similar topics

99
by: David MacQuigg | last post by:
I'm not getting any feedback on the most important benefit in my proposed "Ideas for Python 3" thread - the unification of methods and functions. Perhaps it was buried among too many other less...
11
by: Roger Leigh | last post by:
The C++ book I have to hand (Liberty and Horvath, Teach yourself C++ for Linux in 21 Days--I know there are better) states that "static member functions cannot access any non-static member...
47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
6
by: Melkor Ainur | last post by:
Hello, I'm attempting to build an interpreter for a pascal-like language. Currently, I don't generate any assembly. Instead, I just build an abstract syntax tree representing what I've parsed...
11
by: tshad | last post by:
I am setting up some of my functions in a class called MyFunctions. I am not clear as to the best time to set a function as Shared and when not to. For example, I have the following bit...
5
by: Robert Fitzpatrick | last post by:
Can someone point me to some more information or perhaps show an example of returning a recordset from a plpgsql function. I'd like to send an argument or arguments to the function, do some queries...
8
by: Edward Diener | last post by:
By reuse, I mean a function in an assembly which is called in another assembly. By a mixed-mode function I mean a function whose signature has one or more CLR types and one or more non-CLR...
25
by: OziRus | last post by:
Hi, This is my first message on this group. I want to ask something about screen-drawing functions. I wrote and compiled below code succesfully on TC IDE in Win-xp. Then i tried to work it on...
4
by: Bo Berglund | last post by:
I have defined a few functions in a file, let's say it is called functions.cpp. There are no objects involved, these are pure simple functions. In my test application I want to call this...
4
by: ahagley | last post by:
The problem: 1) I'm not a programmer, most of the time I'm a physicist, but I do numerical simulation. 2) I have a DLL that I want to use functions from. I have the .h file associated with the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.