Connecting Tech Pros Worldwide Forums | Help | Site Map

Fsockopen expects parameter 2 to be long. String given.

Newbie
 
Join Date: Nov 2008
Posts: 3
#1: Nov 8 '08
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's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#2: Nov 8 '08

re: Fsockopen expects parameter 2 to be long. String given.


You're missing a semi-colon on line 6.
Newbie
 
Join Date: Nov 2008
Posts: 3
#3: Nov 8 '08

re: Fsockopen expects parameter 2 to be long. String given.


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.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#4: Nov 8 '08

re: Fsockopen expects parameter 2 to be long. String given.


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().
Newbie
 
Join Date: Nov 2008
Posts: 3
#5: Nov 8 '08

re: Fsockopen expects parameter 2 to be long. String given.


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