Log in

View Full Version : help!


AN-net
03-21-2004, 03:01 AM
ok i dont know y this script is not working.


function button_exists($url)
{
$head = "";
$url_p = parse_url($url);
if (isset($url_p["host"]))
{
$host = $url_p["host"];
}
else
{
return false;
}
if (isset($url_p["path"]))
{
$path = $url_p["path"];
}
else
{
$path = "";
}
$fp = fsockopen ($host, 80, $errno, $errstr, 20);
if(!$fp)
{
return false;
}
else
{
$parse = parse_url($url);
$host = $parse['host'];
fputs($fp, "HEAD ".$url." HTTP/1.1\r\n");
fputs($fp, "HOST: ".$host."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
$headers = "";
while(!feof ($fp))
{
$headers .= fgets ($fp, 128);
}
}
fclose($fp);
$arr_headers = explode("\n", $headers);
$return = "false";
if(isset($arr_headers[0]))
{
$return = strpos($arr_headers[0], "404") !== false;
}
return $return;
}

and heres the problem

if(button_exists("$affiliate['buttonurl']")=="false"){
print "this button dont work!$affiliate['affiliate_id']";
}

im getting parse errors

filburt1
03-21-2004, 03:05 PM
im getting parse errors
And those parse errors are...? :)

AN-net
03-21-2004, 04:54 PM
'T_STRING' or `T_VARIABLE' or `T_NUM_STRING'

filburt1
03-21-2004, 05:44 PM
'T_STRING' or `T_VARIABLE' or `T_NUM_STRING'
The entire parse error?

AN-net
03-21-2004, 06:03 PM
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/anima22/public_html/community/affiliate.php on line 210

Dean C
03-21-2004, 06:11 PM
"$affiliate['buttonurl']"

You can't do that... remve the single quotes :)

AN-net
03-21-2004, 06:15 PM
still getting same error

AN-net
03-21-2004, 06:17 PM
got it working turns out i didnt know u cant use $var['blah'] inside quotes:)