Closed jcmlumacad closed 3 years ago
The default user-agent is 'Curl' so it might be blocked by some websites.
Try adding a different user-agent, for example:
$data = \OpenGraph::fetch(
"https://www.instagram.com/p/CNnImF-gvkb/",
true,
null,
null,
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
);
@jcmlumacad can u share the link u were trying to fetch. Also make sure the url is publicly available, and it's available in region u are trying to fetch.
@shweshi Please try this link https://www.instagram.com/p/CNnImF-gvkb I think that's a public URL
I'm expecting something link this result https://developers.facebook.com/tools/debug/?q=https%3A%2F%2Fwww.instagram.com%2Fp%2FCNnImF-gvkb
The default user-agent is 'Curl' so it might be blocked by some websites.
Try adding a different user-agent, for example:
$data = \OpenGraph::fetch( "https://www.instagram.com/p/CNnImF-gvkb/", true, null, null, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36' );
Why do we need a user agent? Is it not working by default?
@jcmlumacad Many websites/links blocks the requests coming from the scripts/tools to prevent the scraping. The default user-agent is Curl
used in the OpenGraph. Try changing it to one suggested by @olavski and see if that works.
@shweshi I see. This should work for now. Thanks
Tried any shared Instagram links. It returns empty