1
I was able to solve my date problem. Currently my problem is to catch all users for some reason my Json is giving only 4 items of 1059 and I want to catch all.
<?php
function buscaUser($user)
{
$opts = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: PHP'
]
]
];
$user= $_GET['username'];
$context = stream_context_create($opts);
$content = file_get_contents('https://api.github.com/search/users?q='.$user, false, $context);
$json = json_decode($content,true);
$jsoncount = count($json);
echo $jsoncount."<br>";
for ($numItem = 0 ; $numItem <= $jsoncount; $numItem++){
echo "<img class='img-thumbnail' width='100px' height='100px' src=".$json['items'][$numItem]['avatar_url']."><br>";
echo $json['items'][$numItem]['login']."<br>";
echo "<a href=".$json['items'][$numItem]['html_url'].">Repositorio</a><br>";
}
}
?>
Without the foreach you can? that code ai generates some warnings
– rray