Jump to content

tanvirtonu

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tanvirtonu's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello I m new to php. I have uploaded a simple php script in my web root - http://www.mydomain.com which will connect to my DB. But strangely I CANT connect to my DB if I put the hostname as my real hostname - mydomain.com . But if I use - localhost , it works. How come its working as- localhost when I am not on localhost. <?php echo "HELLO WORLD"; $connect = mysql_connect("localhost","username","mypassword") or die ("couldn't connect db"); // it works //$connect = mysql_connect("www.mydomain.com","username","mypassword") or die ("couldn't connect db"); // it DOESN'T work ?>
  2. Hello I m new to php. I made a simple html form with two textboxes- username and password but when I run them they always have some default values- admin and a password. Where did they get this default value. I didnt put any value in them. I use xampp as php-mysql server . I have another question. What is the difference between- If ( $variable ) and If ( isSet($variable) ) and if ( empty($variable) )
  3. I m new to php programming. I want to know what is the meaning of double " -> " in php method calling. Like the one in the following example - $this->load->library('class_name', $config, 'object name') Does it mean that the "load" method has the "library" method in it...I m confused..
  4. Failed to connect socket I have written a simple php mailing script using mail peer. My code is as follows- PHP Code: <?php require_once "Mail.php"; $from = "TAnvir Sender <bhonest_4ever2007@yahoo.com>"; $to = "Tonu Recipient <tanvirtonu@yahoo.com>"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "ssl://smtp.mail.yahoo.com"; //$host = "smtp.mail.yahoo.com"; $port='465'; $username = "bhonest_4ever2007"; $password = "abcdefg"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> Now I mgetting this error- "Failed to connect to ssl://smtp.mail.yahoo.com:465 [sMTP: Failed to connect socket: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (code: -1, response: )] " Pls help me.I m using an installer of Apache, MySQL and PHP for Windows called XAMPP 1.6.4 which is a Apache distribution for windows.I dont know how to recompile php with ssl. Bcos all I did to install php is I just installed Xampp installer.It did the rest.Help me. Reply With Quote Quick reply to this message
  5. I have written a simple php mailing script using mail peer. My code is as follows- <?php require_once "Mail.php"; $from = "TAnvir Sender <bhonest_4ever2007@yahoo.com>"; $to = "Tonu Recipient <tanvirtonu@yahoo.com>"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "ssl://smtp.mail.yahoo.com"; //$host = "smtp.mail.yahoo.com"; $port='465'; $username = "bhonest_4ever2007"; $password = "abcdefg"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> Now I mgetting this error- Pls help me.I m using an installer of Apache, MySQL and PHP for Windows called XAMPP 1.6.4 which is a Apache distribution for windows.I dont know how to recompile php with ssl. Bcos all I did to install php is I just installed Xampp installer.It did the rest.Help me.
  6. I tried with PHP mailer but it didnt work. All problem is with correct server name and port or something else.
  7. I have tried several ways to send mail but I hav failed and I m veryyyyyy upset. Now I have few question about mail sending in php 1. I cant/dont use the smtp server of my ISP. Now which server I can send my mail thru? 2. I want to use yahoo smtp mail server. Now do I have to set yahoo smtp server name and port in php.ini? Cant I set these (both name and port)dynamically in php. if so, how? 3.If the server name I m using uses authenticated smtp, WHERE and how to put code for this in php . If in mail header then in which format? 4. I hav come to know the following things from website of yahoo- Outgoing Mail (SMTP) Server: smtp.mail.yahoo.com (Use SSL, port: 465, use authentication) I am also giving u my account details My yahoo id- bhonest_4ever2007@yahoo.com (created 2day for the test) password- abcdefg Now would anybody pls pls tel me or write me a simple code by which I can send mail without using my Isp's smtp server. DO I need to use those info. in php.ini . Or is there any way to add them dynamically in php. I once tried with the following code but nothing happened <?php //mail($recepeint,$subject,$msg,$mailheader); //define the receiver of the email $to = 'bhonest_4ever@yahoo.com'; //define the subject of the email $subject = 'Test email'; //define the message to be sent. Each line should be separated with \n $message = "Hello World!\r\nThis is my first mail."; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: tanvirtonu@yahoo.com\r\nReply-To: tanvirtonu@yahoo.com"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; echo "Thank You <b>Tanvir</b> for ur message"; echo "<p>Your mail address is <p>$to </p>"; echo "<p>Your message was <p> $message </p>"; ?> //I set server=smtp.mail.yahoo.com and port=25 in php.ini and restart the server . NB. If I configure php.ini in php code using ini_set(), wouldn't it be permanent next time. But what happens if I host these php file in another server. There can be a lot other php files trying to do the same thing. Isn't it a problem. I can also send mail using a free smtp server and a mail client in my windows pc which requires default 25 port for smtp. Should I use this port-25 with the above server name smtp.mail.yahoo.com[/code]
  8. I cant send a simple mail from my pc. I dont know smtp server name and port of my ISP. Cant I use any other smtp server and port to send my mail. Wud u pls tell me the name as well as the port of such smtp server. Can I use yahoo's smtp server?
  9. I just wan to write a simple programme which refresh the current page.But I get the following error message- "Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server. If you think this is a server error, please contact the webmaster. Error 403 localhost 10/17/07 19:38:49 Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.3 " I wrote the code using DreamWeaver Web Editor.My code is as follows- php: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>REFRESHING Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form action="<?php echo $_SERVER[php_SELF] ?>" method="POST"> <p> <strong>Type ur guess here</strong> <input type="text" name="guess"> </p> <p> <input type="submit" name="Submit" value="Submit ur guess"> </p> </form> </body> </html> PLs tell me what to do. I hav already run several other pages well.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.