Fsockopen expects parameter 2 to be long. String given.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ryanhami
    New Member
    • Nov 2008
    • 3

    Fsockopen expects parameter 2 to be long. String given.

    I get the error unexpected T_IF on line 124 , line 8 is line 124

    [PHP] #connect to the smtp server
    $this->smtp_conn = fsockopen ($host, # the host of the server
    $port, # the port to use
    $errno, # error number if any
    $errstr, # error message if any
    $tval) # give up after ? secs
    # verify we connected properly
    if(empty($this->smtp_conn)) {
    $this->error = array("error" => "Failed to connect to server",
    "errno" => $errno,
    "errstr" => $errstr);
    if($this->do_debug >= 1) {
    echo "SMTP -> ERROR: " . $this->error["error"] .
    ": $errstr ($errno)" . $this->CRLF;
    }
    return false;
    }[/PHP]
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    You're missing a semi-colon on line 6.

    Comment

    • ryanhami
      New Member
      • Nov 2008
      • 3

      #3
      Thanks for that but when i put that in it then gives me an error "fsockopen( ) expects parameter 2 to be long, string given in /home/atesthos/public_html/class.smtp.php on line 122" which is line 6.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Firstly, Ryan, a title like 'Can Any Body Tell Me Whats Wrong With This?' does not help others who are searching the forum with a problem. Please be as descriptive, while concise, about the problem. It is a forum guideline.

        $port should be a interger.

        Read the manual on fsockopen().

        Comment

        • ryanhami
          New Member
          • Nov 2008
          • 3

          #5
          Thanks for the help, i think i have sorted it now. I dont seem to get any errors.

          Comment

          Working...