Answer the question
In order to leave comments, you need to log in
Why doesn't getCodeFromId Instagram work?
Hello everyone, when parsing data about a post in instagram, an instagram post id of type 1768009994382509677 is sent, there is a function that converts it into a shortcode of type BiJO7j6goZt
function code:
function getCodeFromId($id)
{
$parts = explode('_', $id);
$id = $parts[0];
$alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
$shortenedId = '';
while ($id > 0) {
$remainder = $id % 64;
$id = ($id - $remainder) / 64;
$shortenedId = $alphabet{$remainder} . $shortenedId;
};
return $shortenedId;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question