Answer the question
In order to leave comments, you need to log in
How to output specific data in json array?
There is an application that works with instagram without api, where in the search via curl data is taken from the instagram search
, here is the data
. Curl code:
public function fetchData($url){
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
return $result;
} catch(Exception $e) {
return $e->getMessage();
}
}
public function getSearchProfiles($ignore=null) {
$url = 'https://www.instagram.com/web/search/topsearch/?context=blended&query='.str_replace(' ', '.', $this->query).'&rank_token=';
$result = $this->fetchData($url);
$this->data['profiles'] = $result;
if($ignore != null) {
foreach($this->data['profiles'] as $subKey => $subArray){
if($subArray['username'] == $ignore){
unset($this->data['profiles'][$subKey]);
}
}
}
}
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