NicklasWallgren / PokemonGoAPI-PHP

Pokemon Go API PHP library
BSD 2-Clause "Simplified" License
130 stars 51 forks source link

API requirement #112

Closed plonk5638 closed 8 years ago

plonk5638 commented 8 years ago

hi,

im a PHP programmer since 5 years ago, but new in github (just learn about git and composer about 2 days ago)

i very struggle here to run this API, its around 2-3 hours but always cant work. i download XAMPP 32bit PHP 7 >> get error (i forgot what the error messege) ok i download XAMPP 32bit PHP 5.5 >> get error your php 5.5, minimun req >= 5,6 ok i download XAMPP 32bit PHP 5.6 >> composer install success, then try examples script but getting error: sry we only supp PHP 64bit

i search XAMPP 64bit windows but it doesnt exists yet. so i try WAMPP 64bit PHP 5.6-7.0 >> error : we only support php 64bit WTF. i install wampserver3.0.4_x64_apache2.4.18_mysql5.7.11_php5.6.19-7.0.4.exe but he said i dont use 64bit >.<

i try to install in my VPS , ubuntu 14 64bit >> error your php is 5.5

before i go too far to uninstall - reinstall something, i try to ask a question here. can you give me a clue to run this API? i prefer windows.

ty. im very appreciate your help sry for my english and my bad knowledge

WisdomSky commented 8 years ago

so i try WAMPP 64bit PHP 5.6-7.0 >> error : cmd didnt recognize "php" command. my be wampp have another setting to use PHP CLI that i dont know.

Hi!

This problem is not really related to PokemonGoAPI.

But can you try following this walkthrough tutorial?

Your problem is that php is not recognized by your command prompt because it's not in the PATH, so to make it work, you need to add php to the PATH on your windows.

https://john-dugan.com/add-php-windows-path-variable/

Reminder: be sure to close any active command prompt after you updated the PATH, so that the changes will be applied.

plonk5638 commented 8 years ago

yes i absolutly know my question is not related to PogoAPI but i dont know where i can get help. no discord here.

i try search solution in stackoverflow which is offer the same solution with you. but i get >> error : we only support php 64bit WTF. i install wampserver3.0.4_x64_apache2.4.18_mysql5.7.11_php5.6.19-7.0.4.exe but he said i dont use 64bit >.<

ty man, i appreciated ur help, very usefull


i will explain my cronological/walkthrough how i run this API recently

i download PHP standalone so i wont use XAMPP/WAMPP anymore, i download http://windows.php.net/downloads/releases/php-5.6.24-nts-Win32-VC11-x64.zip , then extract to c:\php

c:\php > mkdir pogoapi c:\php > cd pogoapi create file composer.json and paste this code: {"minimum-stability": "dev", "prefer-stable": true}

go to cmd and type : composer require nicklasw/pkm-go-api c:\php\pogoapi > composer require nicklasw/pkm-go-api result : blablabla.......... Writing lock file Generating autoload files

(i think that means install via composer success)

i copy folder examples from C:\php\pogoAPI\vendor\nicklasw\pkm-go-api\examples to C:\php\pogoAPI\examples cd C:\php\pogoAPI\examples C:\php\pogoAPI\examples>php RetrievePlayerProfileExample.php For now we only support PHP on 64bit platforms \n


i am pretty sure i use PHP 5.6 64bit.

my OS : windows 7 ultimate SP1 64bit PHP standalone : http://windows.php.net/downloads/releases/php-5.6.24-nts-Win32-VC11-x64.zip

c:\php\pogoAPI\examples>php -v PHP 5.6.24 (cli) (built: Jul 20 2016 21:18:46) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

and i check with script below, i called check.php <?php echo "PROCESSOR_ARCHITECTURE => " . $_SERVER["PROCESSOR_ARCHITECTURE"]."\n"; echo "PROCESSOR_IDENTIFIER => " . $_SERVER["PROCESSOR_IDENTIFIER"]."\n"; echo "PROCESSOR_LEVEL => " . $_SERVER["PROCESSOR_LEVEL"]."\n"; echo "PROCESSOR_REVISION => ". $_SERVER["PROCESSOR_REVISION"]; ?>

c:\php\pogoAPI>php a.php PROCESSOR_ARCHITECTURE => AMD64 PROCESSOR_IDENTIFIER => Intel64 Family 6 Model 58 Stepping 9, GenuineIntel PROCESSOR_LEVEL => 6 PROCESSOR_REVISION => 3a09

then run c:\php\pogoAPI\examples>php RetrievePlayerProfileExample.php

result: For now we only support PHP on 64bit platforms \n

OMG , i got headache now, >.<

NOTE: ofc, i uninstall WAMPP and XAMPP before

Ni42 commented 8 years ago

What does echo PHP_INT_SIZE; say?

Can you try using the newest x64 PHP7 version instead? The PHP5 64bit Windows builds are still marked as "experimental".

DragonStar01 commented 8 years ago

i have the same prob :/ Downloaded wamp64 bit but when i try to this code

switch(PHP_INT_SIZE) {
    case 4:
        echo '32-bit version of PHP';
        break;
    case 8:
        echo '64-bit version of PHP';
        break;
    default:
        echo 'PHP_INT_SIZE is ' . PHP_INT_SIZE;
}

it sows

 C:\wamp64\www\NicklasWallgren\examples>php code.php
32-bit version of PHP

Php version

C:\wamp64\www\NicklasWallgren\examples>php -v
PHP 7.0.8 (cli) (built: Jun 21 2016 15:27:20) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

can someone help me with it ?

Ni42 commented 8 years ago

@DragonStar01 You need to install the PHP x64 build from windows.php.net, or it won't work. Technically it's as easy as overwriting the directory, but I have no idea about Wamp.

plonk5638 commented 8 years ago

i try now. --this post will updated--

let me re explained this.

i uninstall wampp and xampp to get this more clearly.

i download http://windows.php.net/downloads/releases/php-5.6.24-nts-Win32-VC11-x64.zip sha1: 5ba2075ac0d7f9ad5c05f1e028349f25f2628fc8 (for search clue in http://windows.php.net/download/)

i register php to PATH windows environment (so we can use php command on cmd) create test.php for testing purpose

<?php echo "PROCESSOR_ARCHITECTURE => " . $_SERVER["PROCESSOR_ARCHITECTURE"]."\n"; echo "PROCESSOR_IDENTIFIER => " . $_SERVER["PROCESSOR_IDENTIFIER"]."\n"; echo "PROCESSOR_LEVEL => " . $_SERVER["PROCESSOR_LEVEL"]."\n"; echo "PROCESSOR_REVISION => ". $_SERVER["PROCESSOR_REVISION"]."\n"; echo "PHP_INT_SIZE => ". PHP_INT_SIZE; ?>

result

C:\php\pogoAPI>php test.php PROCESSOR_ARCHITECTURE => AMD64 PROCESSOR_IDENTIFIER => Intel64 Family 6 Model 58 Stepping 9, GenuineIntel PROCESSOR_LEVEL => 6 PROCESSOR_REVISION => 3a09 PHP_INT_SIZE => 4 C:\php\pogoAPI>php -v PHP 5.6.24 (cli) (built: Jul 20 2016 21:18:46) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

i download 64bit,but still detected as 32bit (PHP_INT_SIZE = 4)

maybe its because just for "experimental" like you say

i download PHP7 http://windows.php.net/downloads/releases/php-7.0.9-nts-Win32-VC14-x64.zip VC14 x64 Non Thread Safe sha1: 22b9987a75aa40c1ae0eefd50f717505095e14dd

extract to c:\php7 unregister PATH for PHP5 (above) register PATH for PHP7

i run same script,

C:\php7\pogoAPI>php test.php PROCESSOR_ARCHITECTURE => AMD64 PROCESSOR_IDENTIFIER => Intel64 Family 6 Model 58 Stepping 9, GenuineIntel PROCESSOR_LEVEL => 6 PROCESSOR_REVISION => 3a09 PHP_INT_SIZE => 8 C:\php7\pogoAPI>php -v PHP 7.0.9 (cli) (built: Jul 20 2016 10:47:41) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

sounds good, now its detected as 64bit (PHP_INT_SIZE => 8)

create composer.json

{"minimum-stability": "dev", "prefer-stable": true}

run : composer require nicklasw/pkm-go-api error : openssl need enabled

enabled extenstion openssl enabled extension_dir = "my php ext place" , in my case extension_dir = "ext"

run again : composer require nicklasw/pkm-go-api error : not find ext mbstring

i enabled extension=php_mbstring.dll

run again : composer require nicklasw/pkm-go-api result : success

blablabla.. Writing lock file Generating autoload files

i copy folder "examples" from C:\php7\pogoAPI\vendor\nicklasw\pkm-go-api\examples to C:\php7\pogoAPI\examples (for testing API script purpose) cd C:\php7\pogoAPI\examples php RetrievePlayerProfileExample.php ERROR : username password incorrect

i change username and password PTC in RetrievePlayerProfileExample.php run again : php RetrievePlayerProfileExample.php

WORK LIKE A CHARM

thanks man, u safe my day i just wasting 3 days for finding pogoAPI in PHP (i try 5 of them with different problem) now i can focus learn to use this API.

thanks for your help Ni42. hope this thread can help someone with same problem

NicklasWallgren commented 8 years ago

Resolved.

DrDelay commented 8 years ago

This "trial-and-error" log could actually help some Windows users. Some more formatting and this could be in the wiki.

Ni42 commented 8 years ago

@plonk5638 Happy to help ;) If you want to ping someone, place @ in front of their name, you even get autocompletion for that here.

Maybe we should really write a little document on the requirements/environment setup. It seems like there is a PHP7 req on Windows at least.

plonk5638 commented 8 years ago

@Ni42 thanks. for this clue -> @