Giter Club home page Giter Club logo

instaphp's People

Contributors

hitoshi-t-pepe3 avatar lsolesen avatar luads avatar nikolaymatrosov avatar nobuhiko avatar nyholm avatar ollietb avatar reneszabo avatar rmasters avatar sesser avatar stephen-crowdreactive avatar thefrozenfire avatar tomothumb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

instaphp's Issues

Malformed json

Hi

I'm getting this error:

[User Error] Uncaught GuzzleHttp\Exception\ParseException: Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON

Trace
GuzzleHttp\Message\Response->json()
Response.php:104
Instaphp\Instagram\Response->__construct(HTTP/1.1 404 Not Found Content-Language: en Expires: Sat, 01 Jan 2000 00:00:00 GMT Vary: Cookie, Accept-Language Pragma: no-cache Cache-Control: private, no-cache, no-store, must-revalidate Date: Fri, 01 Jul 2016 08:34:02 GMT X-Frame-Options: SAMEORIGIN Content-Type: text/html Set-Cookie: csrftoken=tB34silDlCK4HPfbyvGUMxV5q6sayjNB; expires=Fri, 30-Jun-2017 08:34:02 GMT; Max-Age=31449600; Path=/ Connection: keep-alive Content-Length: 25167 <script type="text/javascript">window._timings = {"domLoading": Date.now()}</script> <title> Instagram </title> <script type="text/javascript"> WebFontConfig = { custom: { families: ['proxima-nova:n3,n4,n6,n7'], } }; </script> <script src="//instagramstatic-a.akamaihd.net/h1/scripts/webfont.js/c0456c81549b.js" type="text/javascript" async></script> <style type="text/css"> /* @license * MyFonts Webfont Build ID 2164953, 2012-03-23T23:06:30-0400 * * The fonts listed in this notice are subject to the End User License * Agreement(s) entered into by the website owner. All other parties are * explicitly restricted from using the Licensed Webfonts(s). * * You may obtain a valid license at the URLs below. * * * Webfont: Proxima Nova Light by Mark Simonson * URL: http://www.myfonts.com/fonts/marksimonson/proxima-nova/light/ * Licensed pageviews: unlimited * * Webfont: Proxima Nova Regular by Mark Simonson * URL: http://www.myfonts.com/fonts/marksimonson/proxima-nova/regular/ * Licensed pageviews: unlimited * * Webfont: Proxima Nova Semibold by Mark Simonson * URL: http://www.myfonts.com/fonts/marksimonson/proxima-nova/semibold/ * Licensed pageviews: unlimited * * Webfont: Proxima Nova Bold Italic by Mark Simonson * URL: http://www.myfonts.com/fonts/marksimonson/proxima-nova/bold-it/ * Licensed pageviews: unlimited * * Webfont: Proxima Nova Bold by Mark Simonson * URL: http://www.myfonts.com/fonts/marksimonson/proxima-nova/bold/ * Licensed pageviews: unlimited * * Webfont: Proxima Nova Italic by Mark Simonson * URL: http://www.myfonts.com/fonts/marksimonson/proxima-nova/regular-it/ * Licensed pageviews: unlimited * * * License: http://www.myfonts.com/viewlicense?type=web&buildid=2164953 * Webfonts copyright: Copyright (c) Mark Simonson, 2005. All rights reserved. * * (c) 2012 Bitstream Inc / @font-face { font-family: 'proxima-nova'; src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-bold-webfont.eot/115b1f7f9c04.eot'); src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-bold-webfont.eot/115b1f7f9c04.eot?#iefix') format("embedded-opentype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-bold-webfont.woff/618250d25a4d.woff') format("woff"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-bold-webfont.ttf/646346e03084.ttf') format("truetype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-bold-webfont.svg/e55a9d6051e8.svg#ProximaNovaBold') format("svg"); font-weight: bold; font-style: normal; } @font-face { font-family: 'proxima-nova'; src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-boldit-webfont.eot/1cbb869da891.eot'); src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-boldit-webfont.eot/1cbb869da891.eot?#iefix') format("embedded-opentype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-boldit-webfont.woff/b1cf049474c9.woff') format("woff"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-boldit-webfont.ttf/3adb020ceae3.ttf') format("truetype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-boldit-webfont.svg/29948a2d3c58.svg#ProximaNovaBoldItalic') format("svg"); font-weight: bold; font-style: italic; } @font-face { font-family: 'proxima-nova'; src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-reg-webfont.eot/12af77715cee.eot'); src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-reg-webfont.eot/12af77715cee.eot?#iefix') format("embedded-opentype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-reg-webfont.woff/a9a9773b8e29.woff') format("woff"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-reg-webfont.ttf/99e19808976a.ttf') format("truetype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-reg-webfont.svg/c33d2fd56309.svg#ProximaNovaRegular') format("svg"); font-weight: normal; font-style: normal; } @font-face { font-family: 'proxima-nova'; src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-regit-webfont.eot/1bbbd1312b0d.eot'); src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-regit-webfont.eot/1bbbd1312b0d.eot?#iefix') format("embedded-opentype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-regit-webfont.woff/9e306befca91.woff') format("woff"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-regit-webfont.ttf/4a8663684135.ttf') format("truetype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-regit-webfont.svg/876278d4b189.svg#ProximaNovaRegularItalic') format("svg"); font-weight: normal; font-style: italic; } @font-face { font-family: 'proxima-nova'; src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-sbold-webfont.eot/5016edf79e1d.eot'); src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-sbold-webfont.eot/5016edf79e1d.eot?#iefix') format("embedded-opentype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-sbold-webfont.woff/615c1b06d8fa.woff') format("woff"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-sbold-webfont.ttf/2973bd483f7a.ttf') format("truetype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-sbold-webfont.svg/868597833e49.svg#ProximaNovaSemibold') format("svg"); font-weight: 600; font-style: normal; } </style> <style type="text/css"> @font-face { font-family: 'proxima-nova'; src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-light-webfont.eot/63c84728610f.eot'); src: url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-light-webfont.eot/63c84728610f.eot?#iefix') format("embedded-opentype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-light-webfont.woff/66bbe029f180.woff') format("woff"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-light-webfont.ttf/eb408516399b.ttf') format("truetype"), url(' //instagramstatic-a.akamaihd.net/h1/webfonts/proximanova-light-webfont.svg/858f6a9b7ef3.svg#ProximaNovaLight') format("svg"); font-weight: 300; font-style: normal; } </style> <script type="text/javascript"> (function() { var docElement = document.documentElement; var classRE = new RegExp('(^|\s)no-js(\s|$)'); var className = docElement.className; docElement.className = className.replace(classRE, '$1js$2'); })(); </script> <style type="text/css">/ @generated / / DO NOT CHANGE THIS FILE. INSTEAD, MODIFY 'distillery/templates/main.css' / / css shared between /about and /developer / / run build/scripts/css_transform_distillery.sh if you change this file / body { -webkit-font-smoothing: antialiased; background-color: #fafafa; font-family: 'proxima-nova', 'Helvetica Neue', Arial, Helvetica, sans-serif; margin-bottom: 60px; margin: 0; } a { text-decoration: none; } /*...)
Instagram.php:331

script return error

This code:

<?php
//-- Include our library
include_once 'instaphp/instaphp.php';

//-- Get an instance of the Instaphp object
$api = Instaphp\Instaphp::Instance();

//-- Get the response for Popular media
$response = $api->Media->Popular();

//-- Check if an error was returned from the API
if (empty($response->error))
    {
    foreach ($response->data as $item)
        printf('<img src="%s" width="%d" height="%d" alt="%s">', $item->images->thumbnail->url, $item->images->thumbnail->width, $item->images->thumbnail->height, empty($item->caption->text) ? 'Untitled':$item->caption->text);
    } else {
    print_r($response->error);
    }
?>

return below array:

Instaphp\Error Object ( [type] => cURLResponseError [code] => 0 [message] => Unknown error ocurred making this request [url] => https://api.instagram.com/v1/media/popular?client_id=b5301a429b184b10995844be4d099849 )

What is it? What I should do?

Very big vendor-folder

Hi guys,

question: do i need all the content of the created "vendor" folder? With 8MB it´s very big.. because i´m using your project to develope a wordpress plugin i have to optimize as much as possible to keep the plugin-file small.

Content of vendor folder: bin (folder), composer (folder), guzzlehttp (folder), monolog (folder), phpunit (folder), psr (folder), react (folder), symfony (folder), autoload.php
.. do i need all of this for your plugin in live-version?

Thank you very much!
Greetings

Problem retrieving recent data from a user

I´m trying this call

$code = $_REQUEST['code'];
$inst1 = Instaphp::Instance();
$miuser = new Users();
$respuesta = $miuser->Authenticate($code);
$access_token = $respuesta->auth->access_token;
$user_id = $respuesta->auth->user->id;
$arr = array("access_token" => $access_token);
$recent = $miuser->Recent($user_id, $arr);

but the object $recent myself that I returned is null
doing a trace on the file "response.php" i can print the url value and this has the correct structure on $opts[CURLOPT_URL]: https://api.instagram.com/v1/users/83272/media/recent/?client_id=MYCLIENTID&access_token=MYACCESTOKEN

But when I go to print out the contents of the variable $res I see is empty (after this line if (false !== ($res = curl_exec($this->ch))) {)

What am I doing wrong?

Login problem with Safari (missing php sessions)

Hello again!

I write because I'm having problems with login to instagram (with the iframe method). I have it really the problem with Safari. There seems to be a problem with PHP and this browser session when they are created from an iframe. I've seen the same problem happens in instaview.me. The problem grew as devices such as iPhone and iPad using Safari. (To see exactly what I'm talking about you can try to validate you in your application through your iPhone or through Safari for PC, cheesy the second time you try to validate you can read the session).

I have been looking on the internet about this issue but have not found any solution.

Can you think of a solution?

Invalid dependency

I just upgraded to the latest version of instaphp and it looks like guzzlehttp/log-subscriber is not compatible with Guzzle 6

See the note from https://github.com/guzzle/log-subscriber

[DEPRECATED AND ABANDONED] Logs HTTP requests and Responses as they are sent over the wire. Not used in Guzzle 6.

@sesser Could you revert the composer change which updated the Guzzle requirement to 6?

Monolog requirement error in composer.json

Hi

Is there any reason to get stuck with 1.8.* version? I get a conflict because other library needs at least 1.12 version. Or maybe instead 1.8.* you meant ~1.8?

Could we change monolog versioning for ~1.8, please?

InvalidInstagramResponseException: The response from Instagram cannot be parsed.

Hi, I got this error when using instaphp through hautelook InstagramBundle

An exception has been thrown during the rendering of a template ("The response from Instagram cannot be parsed.")

[2/2] Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("The response from Instagram cannot be parsed.") in index.html.twig at line 36. +
[1/2] InvalidInstagramResponseException: The response from Instagram cannot be parsed. -

in C:\xampp\htdocs\Symfony\vendor\hautelook\instagram-bundle\Hautelook\InstagramBundle\Instagram\Manager.php at line 58  -
            }
            if (empty($data) || !is_array($data)) {
                throw new InvalidInstagramResponseException();
            }
            $rawResponseData = array_slice($data, 0, min($numRecent, self::MAX_RECENT)); 

Can you please tell me what I did wrong ?

Class 'Monolog\Logger' not found

I get this error on trying to instantiate the instaphp class. I am not using composer; Just downloaded the source and included the php file.

An example of use instaphp

Could you upload a file type to learn how to use such methods?
For example, something simple, to authenticate a user ... recover your photos ... thank you very much in advance

Fatal error: Class 'Instaphp' not found in \profile\index.php on line 18

I have
Fatal error: Class 'Instaphp' not found in \profile\index.php on line 18

File index.php: ('Instaphp' folder at 'profile' folder)

<?php
/* gentlemen, start your sessions */

session_start();

$access_token = null;

/* check to see if we have an access token stored in the session */
if (isset($_SESSION['access_token']) && !empty($_SESSION['access_token']))
    $access_token = $_SESSION["access_token"];

/*
 Get our Instaphp instance passing the $access_token
 Once the access_token is set, there's no need to pass
 it along in subsequent api calls as it is automatically
 passed.
*/
$api = Instaphp::Instance($access_token);

/* if the access_token is empty, do your authentication here */
if (empty($access_token)) {
    if (isset($_REQUEST["code"])) {
        $res = $api->Users->Authenticate($_REQUEST["code"]);
        if (empty($res->error) && !empty($res->auth->access_token)) {
            $_SESSION["access_token"] = $res->auth->access_token;
            /* store the user object in the session as well... don't forget to serialize */
            $_SESSION["auth_user"] = @serialize($res->auth->user);
        }
    }
}

/* 
 no need to create any new Instaphp objects. 
 They're already setup in the main Instaphp object.
*/
$recent = $api->Users->Recent("self");

/* Your data should be here */
print_r($recent->data);?>

How to fix it?

fatal error using test code.

Fatal error: Uncaught exception 'ReflectionException' with message 'Class Instaphp\Instagram\Media does not exist' in /usr/local/www/apache24/data/Instaphp/src/Instaphp/Instaphp.php:111 Stack trace: #0 /usr/local/www/apache24/data/Instaphp/src/Instaphp/Instaphp.php(111): ReflectionClass->__construct('Instaphp\Instag...') #1 /usr/local/www/apache24/data/success.php(12): Instaphp\Instaphp->__get('Media') #2 {main} thrown in /usr/local/www/apache24/data/Instaphp/src/Instaphp/Instaphp.php on line 111

Bad Request

Hi!

When I try post or delete request, for example

$this->instaphp->Media->Like($id);

I get fallowing errors
2015-08-17 3 01 08

Can you help me, sesser?

trying to use your example

did the composer install
included the file to the autoload.php

getting this error when attempting your example:

<br />
<b>Fatal error</b>:  Uncaught Instaphp\Exceptions\HttpException: Bad Request in /var/www/html/vendor/instaphp/instaphp/src/Instaphp/Instagram/Instagram.php:364
Stack trace:
#0 /var/www/html/vendor/instaphp/instaphp/src/Instaphp/Instagram/Instagram.php(201): Instaphp\Instagram\Instagram-&gt;parseResponse(Object(GuzzleHttp\Message\Response))
#1 /var/www/html/vendor/instaphp/instaphp/src/Instaphp/Instagram/Media.php(55): Instaphp\Instagram\Instagram-&gt;get('/media/popular', Array)
#2 /var/www/html/testy.php(12): Instaphp\Instagram\Media-&gt;Popular(Array)
#3 {main}
  thrown in <b>/var/www/html/vendor/instaphp/instaphp/src/Instaphp/Instagram/Instagram.php</b> on line <b>364</b><br />

Enforce signed header

Using signed headers, we can call more times certains POST endpoints. For example, POST /users/user-id/relationships endpoint without signing the limit is 20 calls per hour, with signature, we can do 60 (https://instagram.com/developer/limits/). To sign the header, here is the doc: https://instagram.com/developer/restrict-api-requests/#enforce-signed-header.

My implementation proposal:

  • Add a boolean parameter enforce_signed_header, false by default.
  • Add a ips parameter, 127.0.0.1 by default.
  • If enforce_signed_header is true, we add a header Insta-X-Forwarded-For to request Guzzle having as value <ip_information>|<signature> as described in the documentation page.

Pagination functionality missing?

In the response object the pagination data is filled correctly (next_url & next_max_id) when the user has more then 20 recent photos.

Is there a way to reach the next photos? I couldn't figure out how it works.

thanks.

How can I do a logout of the user connected?

Hello again!!

I need to logout the connected user of Instagram.

How can I do this?

In instaphp I can´t see any function or method, and I can´t see it in the official api instagram too.

Thank you very much for your support!!

GuzzleHttp error

Fatal error: Uncaught GuzzleHttp\Ring\Exception\ConnectException: cURL error 28: Resolving timed out after 2511 milliseconds in /var/www/html/tyn/Instaphp/vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php:126 Stack trace: #0 /var/www/html/tyn/Instaphp/vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php(91): GuzzleHttp\Ring\Client\CurlFactory::createErrorResponse(Array, Array, Array) #1 /var/www/html/tyn/Instaphp/vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php(96): GuzzleHttp\Ring\Client\CurlFactory::createResponse(Array, Array, Array, Array, Resource id #4) #2 /var/www/html/tyn/Instaphp/vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php(68): GuzzleHttp\Ring\Client\CurlHandler->_invokeAsArray(Array) #3 /var/www/html/tyn/Instaphp/vendor/guzzlehttp/ringphp/src/Client/Middleware.php(54): GuzzleHttp\Ring\Client\CurlHandler->__invoke(Array) #4 /var/www/html/tyn/Instaphp/vendor/guzzlehttp/ringphp/src/Client/Middleware.php(30): GuzzleHttp\Ring\Client\Middleware::GuzzleHttp\Ring\Client{closure}(Array) #5 /var/www/html/ in /var/www/html/tyn/Instaphp/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 49

Missing signature error

Hello I got this error when I execute the demo in the readme:

...
  array(3) {
    ["code"]=>
    int(403)
    ["error_type"]=>
    string(23) "OAuthForbiddenException"
    ["error_message"]=>
    string(56) "Invalid signed-request: Missing required parameter 'sig'"
  }
...

I added getNextPage() to Response object

I thought you might be interested in some simple functionality I added to the Symfony version of Instaphp

ollietb/OhInstagramBundle@95aca8b

Can be used like this:

    $response = $this->api->Tags->Recent($tag, $options);
    do {
            $pages[] = $response->data;
    } while($response = $response->getNextPage());

It will get every page of results and put each into the $pages array

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.