Instagram is_private 正则表达式
Instagram is_private regex
我想检查用户在 Instagram 上是否是私密的。在互联网上搜索时,我发现了这个:Getting basic information from Instagram using PHP
$raw = file_get_contents('https://www.instagram.com/USERNAME');
preg_match('/\"followed_by\"\:\s?\{\"count\"\:\s?([0-9]+)/',$raw,$m);
print intval($m[1]);
它使用正则表达式检查用户的关注者数量。
现在我正在尝试使用正则表达式来检查用户是否是私有的,但我无法弄清楚。该字段在 JSON 响应中表示为 is_private
,但我无法使其正常工作。
这样做正确吗?
您不想使用 Regex 来执行此操作,而是查看网页
$instagramPage = strip_tags(file_get_contents('http://instagram.com/Username'));
if (strpos($instagramPage,'"is_private":true') !== false) {
return 'Account is private';
} else {
return 'Account is public';
}
我想检查用户在 Instagram 上是否是私密的。在互联网上搜索时,我发现了这个:Getting basic information from Instagram using PHP
$raw = file_get_contents('https://www.instagram.com/USERNAME');
preg_match('/\"followed_by\"\:\s?\{\"count\"\:\s?([0-9]+)/',$raw,$m);
print intval($m[1]);
它使用正则表达式检查用户的关注者数量。
现在我正在尝试使用正则表达式来检查用户是否是私有的,但我无法弄清楚。该字段在 JSON 响应中表示为 is_private
,但我无法使其正常工作。
这样做正确吗?
您不想使用 Regex 来执行此操作,而是查看网页
$instagramPage = strip_tags(file_get_contents('http://instagram.com/Username'));
if (strpos($instagramPage,'"is_private":true') !== false) {
return 'Account is private';
} else {
return 'Account is public';
}