Get Instagram post contents php -
i want develop php project getting content of instagram post (via post url). mean, example, crawler getting url , returning :
#tbt used love carrying them both @ once #twinmom #mycoconuts #mylifeinmyhands #toobignow #istilltrysometimes #love #forevermybabies
after used file_get_contents, of returned response empty. don't know how fix problem. can me?
i don't want use instagram api!
you shouldn't use since break instagram makes change markup, here go:
<?php $instagram_url = "https://www.instagram.com/p/bx6iowxfbq9"; $source = file_get_contents($instagram_url); preg_match('/<script type="text\/javascript">window\._shareddata =([^;]+);<\/script>/', $source, $matches); $data = json_decode($matches[1]); echo $data->entry_data->postpage[0]->graphql->shortcode_media->edge_media_to_caption->edges[0]->node->text;
Comments
Post a Comment