I have found a way of this to work...
<?php
function remoteFileExists($url) {
$curl = curl_init($url);
//don't fetch the actual page, you only want to check the connection is ok
curl_setopt($curl, CURLOPT_NOBODY, true);
//do request
$result = curl_exec($curl);
$ret = false;
//if request did not fail
if ($result !== false) {
//if request was ok, check response code
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($statusCode == 200) {
$ret = true;
}
}
curl_close($curl);
return $ret;
}
$exists = remoteFileExists('http://www.xboxgamertag.com/search/gamertag');
if ($exists) {
echo 'Gamertag VALID Please complete form';
} else {
echo 'Gamertag INVALID Please check and try again';
}
?>
All I need to do now is replace the word 'gamertag' for the string in my form which is $userlogin
I know its basic but how do I place the string in this argument.
I have tried {$userlogin} .$user_login. 'echo $user_login' and various other things.
I have also tried replacing the whole url 'http://www.xboxgamertag.com/search/gamertag' with a $testurl
and had a $testurl = 'http://www.xboxgamertag.com/search/gamertag' before it but the remoteFileExists argument doesnt like it and keeps returning as valid
Any advice?