Bolandish / PHP-Instagram-Grabber

A workaround for the new Instagram policy to get images by hashtag and user id. No need for accesstoken :)
151 stars 39 forks source link

The CURL get nothing #27

Open ivanckt opened 7 years ago

ivanckt commented 7 years ago

I got the following errors when running the example.php

Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 68 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 88 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 88 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 110 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 110 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 125 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 125 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 139 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 139 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 68 Notice: Trying to get property of non-object in C:\xampp\htdocs\igtest\src\Instagram.php on line 68 Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\igtest\test\example.php on line 21 Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\igtest\test\example.php on line 27

I have checked that the curl in the function "getContentsFromUrl" return empty

ivanckt commented 7 years ago

BTW, i used the chrome plugin "Postman" with the following code and I can get result from the instagram.

POST /query/ HTTP/1.1 Host: www.instagram.com X-CsrfToken: xuPHeknUZSh9aaWdzi0M3Qohisp7W2Tz Referer: https://www.instagram.com/ Cache-Control: no-cache Postman-Token: 18e204b6-418c-6997-8dc0-88154b52bed0 Content-Type: application/x-www-form-urlencoded

q=ig_hashtag(apple)+%7B+media.first(12)+%7B++count%2C++nodes+%7B++++caption%2C++++code%2C++++comments+%7B++++++count++++%7D%2C++++comments_disabled%2C++++date%2C++++dimensions+%7B++++++height%2C++++++width++++%7D%2C++++display_src%2C++++id%2C++++is_video%2C++++likes+%7B++++++count++++%7D%2C++++owner+%7B++++++id++++%7D%2C++++thumbnail_src%2C++++video_views++%7D%2C++page_info%7D+%7D

ghost commented 7 years ago

Check php5-curl was installed. I also had same problem, but after install php5-curl package, it work.

ivanckt commented 7 years ago

just found in the other post that we need :

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); in the instragram.php, otherwise the curl exec return nothing