Notice: Array to string conversion, how to fix?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
19 views
When running a site with a bot, writes:
Notice: Array to string conversion in /storage/ssd1/620/5584620/public_html/bot.php on line 128
burning
Here is the script:
$start = microtime(true);
do {
$u_id = 484441685;
$get_params = http_build_query($require_da);
$result = json_decode(file_get_contents('https://api.vk.com/method/messages.getLongPollServ...'),true);
if (isset($result['response']['ts'])){
$bd = $result['response']['ts'];
print_r($bd);
}
$bd=array($bd);
$require_dva = array(
'ts' => $bd
'events_limit' => 1000,
'msgs_limit' => 200,
'v' => '5.76',
'access_token' => $token
);
getme:
$get_params2 = http_build_query($require_dva);
$result2 = json_decode(file_get_contents('https://api.vk.com/method/messages.getLongPollHist...'.$bd.'&msgs_limit=200&events_limit=1000&access_token=*token*'),true);
And yet, if you can, please tell me, what value should be set to $bd?
by | 19 views

1 Answer

0 like 0 dislike
$bd=array($bd);
In this line the variable $bd becomes an array with one element - what used to lay in this variable.

$result2 = json_decode(file_get_contents('https://api.vk.com/method/messages.getLongPollHist...'.$bd.'msgs_limit=200& ...

And in this line the variable $bd, which is now an array, joins the line. Hence the warning.
by

Related questions

0 like 0 dislike
2 answers
asked Apr 25, 2019 by Shelderr
0 like 0 dislike
1 answer
asked Apr 14, 2019 by HealerFive
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 3, 2019 by s_katala
110,608 questions
257,187 answers
0 comments
40,796 users