S
S
Super0leg2017-01-21 00:23:28
PHP
Super0leg, 2017-01-21 00:23:28

How to send a large request (vk api/curl)?

I use this class https://github.com/vladkens/VK

$vk = new VK\VK($this->client_id, $this->client_secret,$user["access_token"]);

        $posts = $vk->api('pages.save', array(
            'group_id'   => $this->group_id,
            'page_id' => $this->page_id,
            'text' => $text,
            'version' => '5.62'));
        var_dump($posts);

It is necessary to transfer a large text (slightly more than 4 thousand characters). Everything works well, but when I exceed this number, NULL is returned. How can this restriction be removed? As I understand it, curl does not allow you to transfer more.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Orlov, 2017-01-21
@orlov0562

Wangyu that these are not Kurla restrictions, but VK restrictions.
try for debugging time, in
https://github.com/vladkens/VK/blob/master/src/VK/...
change this:

private function request($url, $method = 'GET', $postfields = array())
    {
        curl_setopt_array($this->ch, array(
            CURLOPT_USERAGENT => 'VK/1.0 (+https://github.com/vladkens/VK))',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_POST => ($method == 'POST'),
            CURLOPT_POSTFIELDS => $postfields,
            CURLOPT_URL => $url
        ));
        return curl_exec($this->ch);
    }

on this
private function request($url, $method = 'GET', $postfields = array())
    {
        curl_setopt_array($this->ch, array(
            CURLOPT_USERAGENT => 'VK/1.0 (+https://github.com/vladkens/VK))',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_POST => ($method == 'POST'),
            CURLOPT_POSTFIELDS => $postfields,
            CURLOPT_URL => $url
        ));
        $ret = curl_exec($this->ch);
        if (curl_error($this->ch)) die('CURL ERR:'.curl_error($this->ch));
         return $ret;
    }

I think, when executed, it will fall with an error from VK

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question