D
D
dj_vadim2015-08-15 17:53:08
PHP
dj_vadim, 2015-08-15 17:53:08

PHP error 504 when working with Vk PHP SDK?

Good day.
What causes a 504 Gateway Time-out error? (hosting with nginx/1.9.2)
Wrote a php script that uses vk php sdk to search for users via api and writes them to the id file. Until some point, everything worked fine, and then after making changes to the code, the browser loads the tab and nothing happens, and after a minute an error occurs. If you enter from the phone, it displays Error occurred.

require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'VkPhpSdk.php';
            require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'Oauth2Proxy.php';
            // Init OAuth 2.0 proxy
            $oauth2Proxy = new Oauth2Proxy(
                '111', // client id
                '111', // client secret
                'https://oauth.vk.com/access_token', // access token url
                'https://oauth.vk.com/authorize', // dialog uri
                'code', // response type
                'http://clients.123.ru/vkphp/example/index.php', // redirect url
            	'offline,notify,friends,photos,audio,video,wall' // scope
            );
            
            // Try to authorize client
            if($oauth2Proxy->authorize() === true) {
            	// Init vk.com SDK
            	$vkPhpSdk = new VkPhpSdk();
            	$vkPhpSdk->setAccessToken($oauth2Proxy->getAccessToken());
            	$vkPhpSdk->setUserId($oauth2Proxy->getUserId());
// тут мой скрипт
$result = $vkPhpSdk->api('users.search', array('q' => $_GET['q']));
                    record_in_file($result,$filep); // запись в файл результата
} else echo '<p>Error occurred</p>';

All the code is standard, but why the server is silent is unclear.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SuperNatural, 2016-12-04
@SuperNatural

Did you manage to solve it? I seem to have the same

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question