dezkit Posted December 6, 2008 Share Posted December 6, 2008 Is it possible for php to echo all the possible combinations of 2 lettered words? as in A1, A2, A3, A4, A5, A6, A7, A8, A9, A0, etc If so, how can i do this? Quote Link to comment Share on other sites More sharing options...
premiso Posted December 6, 2008 Share Posted December 6, 2008 $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alha); foreach ($alphaArray as $alpha) { foreach ($alphaArray as $alpha2) { echo $alpha . $alpha2 ", "; } } Quote Link to comment Share on other sites More sharing options...
dezkit Posted December 6, 2008 Author Share Posted December 6, 2008 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/cobi/public_html/testtt.php on line 8 <?php $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alha); foreach ($alphaArray as $alpha) { foreach ($alphaArray as $alpha2) { echo $alpha . $alpha2 ", "; // line 8 } } ?> line 8 Quote Link to comment Share on other sites More sharing options...
dezkit Posted December 6, 2008 Author Share Posted December 6, 2008 Nevermind, i fixed it, but it shows nothing but a comma on my page <?php $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alha); foreach ($alphaArray as $alpha) { foreach ($alphaArray as $alpha2) { echo $alpha . $alpha2 . ", "; } } ?> Quote Link to comment Share on other sites More sharing options...
premiso Posted December 6, 2008 Share Posted December 6, 2008 Nevermind, i fixed it, but it shows nothing but a comma on my page <?php $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alha); foreach ($alphaArray as $alpha) { foreach ($alphaArray as $alpha2) { echo $alpha . $alpha2 . ", "; } } ?> <?php $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alpha); //spelling type here foreach ($alphaArray as $alpha) { foreach ($alphaArray as $alpha2) { echo $alpha . $alpha2 . ", "; } } ?> Spelling typo on my part. That should work. Quote Link to comment Share on other sites More sharing options...
dezkit Posted December 6, 2008 Author Share Posted December 6, 2008 Thanks, it works now Quote Link to comment Share on other sites More sharing options...
dezkit Posted December 6, 2008 Author Share Posted December 6, 2008 I got one more question, i have this right now <?php $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alpha); foreach ($alphaArray as $alpha) { foreach ($alphaArray as $alpha2) { echo $alpha . $alpha2 . "<br>"; } } ?> Is it possible so that every combination gets checked if its valid in "http://profile.mygamercard.net/*". If the gamertag exists, echo true, and if not echo false. elaborated: - php fread http://profile.mygamercard.net/x (x as in the combination of letters) - if the content displays "does not exist on Xbox Live!", echo false - Else echo true Thanks sooooooooooooooo much in advance!!! Quote Link to comment Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 are the combinations of letters in a txt file? and are they in there line by line or seperated? Quote Link to comment Share on other sites More sharing options...
dezkit Posted December 6, 2008 Author Share Posted December 6, 2008 It's the foreach loop Quote Link to comment Share on other sites More sharing options...
gevans Posted December 7, 2008 Share Posted December 7, 2008 I meant the letters that you have set. I can see where the first array comes from Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted December 7, 2008 Share Posted December 7, 2008 Is it possible so that every combination gets checked if its valid in "http://profile.mygamercard.net/*". If the gamertag exists, echo true, and if not echo false. elaborated: - php fread http://profile.mygamercard.net/x (x as in the combination of letters) - if the content displays "does not exist on Xbox Live!", echo false - Else echo true Yes, that's possible. You'd just need to parse the web page to find out if the gamertag exists or not. Of course, the website might not be too happy with you bombarding them with requests. $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alha); The range function exists for a reason Quote Link to comment Share on other sites More sharing options...
premiso Posted December 7, 2008 Share Posted December 7, 2008 Is it possible so that every combination gets checked if its valid in "http://profile.mygamercard.net/*". If the gamertag exists, echo true, and if not echo false. elaborated: - php fread http://profile.mygamercard.net/x (x as in the combination of letters) - if the content displays "does not exist on Xbox Live!", echo false - Else echo true Yes, that's possible. You'd just need to parse the web page to find out if the gamertag exists or not. Of course, the website might not be too happy with you bombarding them with requests. $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alha); The range function exists for a reason You learn something new every day =) Quote Link to comment Share on other sites More sharing options...
dezkit Posted December 7, 2008 Author Share Posted December 7, 2008 I don't care about my server, i got infinite bandwidth And yeahhhh.... uh... I don't get what does range() do Quote Link to comment Share on other sites More sharing options...
dezkit Posted December 7, 2008 Author Share Posted December 7, 2008 Anyways, does anybody know how to check if there a letter in a string? Quote Link to comment Share on other sites More sharing options...
dezkit Posted December 7, 2008 Author Share Posted December 7, 2008 Sorry for so much bumping (really i am.) but i have this code: <?php $alpha = "a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 0"; $alphaArray = split(" ", $alpha); //spelling type here foreach ($alphaArray as $alpha) { foreach ($alphaArray as $alpha2) { $main = $alpha.$alpha2; $filename = "http://profile.mygamercard.net/$main"; $handle = fopen($filename, "r"); if(strpos($handle, "does not exist on Xbox Live!") > 0){ echo "true"; } else { echo "false"; } } } ?> I keep getting error "Warning: fopen(http://profile.mygamercard.net/aa) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in /home/cobi/public_html/testtt.php on line 11 false" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.