Intereting Posts

вернуть google контакты api v3 фото?

OK Я пытаюсь восстановить фотографию для каждого contcat, используя google-контакты api v3. Мне удалось вернуть фотографию, но я не могу расшифровать то, что Google набрасывает на меня. как это сделать:

`     JFIF    !"$"$   ``"    A " !12ABQR #abqr       $3C   Ss        0 !1AQ  aq     "2      ? MqM!  zfe @   I  J K  " -5 ҥ UW   8  ͚  J   ,  nȿ   % kM  D?  D  N j6   i >    u  D  ~  Zc4 ^I Iw  Tt  e/Tr (  c    (`  ڪς        )| e NN     G      jH 3 } pD  U   з  Ί<)   hW    E G y۵ [ i   ԰s c  q     j X @, N W     ZE    $_ry   K: Ư   \ʧ   Eq(z G5  y    +\  |  ]  J    ( ( e      6c o     ʹ c  6qw}*,Ebrۄ  +i  ܄5 T   IP"r  R*Z# y   efJt S   R DH    2  j* Lͧ  R7mH 'X  ,Z3 0) p[. W At  h wdl T;) K  G*  -   k  Խ p ߔG :     aى @a #q     X  "     phS.    LW(   CgE    & < L N 7U   | W B  Ǔ6 21   DQ   I   =#F )Pp% 5n    V ^.   ʟ  oX8-8 rIɭ'     jMѵ  v  u5 "  "   o      F     |   b"D7 (W6  & [K  0 ŹM,   = -  QE jS 4MZ 2Kh  *4        L  *$ v   x  K0 ]   U \I l6 i8 c [f   g   اE P $4 F - >$X͇  C  v+   N . $6 m X a 3)2Y   R D  ?R `   e d f љl      y R(1 2 f qٗmu  -K-   ]ț _D    WQ    S˂:      w5  SC ovT lCK  ,n  l      {  Ҏd{H Қ~ ꋊ *~$A " $K 5   w  v sȪ cfO    9   R&1   f@J j  | q (l . ܛ  ( (=h {W  ~  4S GK !`f!  % ̯  k:'*M $$$ "  9 ]   "         k 1      4B H .  Z ѕ<#/'e w  T M4m Z 8   ʆe  ~] Vȕ xU \ ian$ 7 L 6$9Ka  G L   $ʈk]  8 5+a~ x QbN#       W  : 7      ٹ/`   -'g  e x    ]   .    zS_   o;  }   t6 t|  aK%U zί 4     E(   * Y -ߝދ-  1I iV   6 "  䂦I؈U @ 챥 @  -    )   5,  _ yQq  ^ Ű } }   ̵*  /4 V     wR    G c  A  B  ' 2 e   Xϴ K   YGYF CpLI  ImZ        $;  ؁=thy   _   >Ø   :G.ET- BEBQ   I~X  :dbN    E   wԠ F  ~  N  '8@         2<  Bۛns*z   $ θ   @    * U&Dk   F1   7 H L \9I7 lU  )v /{ E |ͧr   *V  ߽)   B'-0.    ${s\4 H   W}2 ْc  !t&  ? ޒh     F  j <;  E p jD A Ľ X p     R 4p    @       {n       bc " M   ^tD m    t 6S `D97  9 T mf]  {GX ӷ   &_E Wܗ  _> Q5    -  D2  m   8 d3  %      fw ͖0-    +^Xt`1 2y .x   [# {c Z$  +O   @p u o0 +e  a %Mٓ|t    p  j =Z   = 1; 8,:   o # ۄIsN    y n   `tRh    q:&  a "=  4=      ㉫۔u R.    y h      n  մ I>$Q }      p ' rVwVG. $Jb@ %.    1O=  $ 4, wlW[C ޛve 2˷+"#=J'l"GT  l ;  u9 ZA # H*>  cy{8I W3   '   4J      mV  {a NtgXc_,  N!    ѕ<# ^9 \= ' p  + N    ] B 7 f  ZO("Aq a6  - 2 ~  3w(9A'AE H @   U   ҇    ̇o  ga ̰ 8  +    tS   ;} 9  J     vTi    H-2QL   D     B      pyygܹ Yd[ Hͽ   rw X ehy Zo ̾0A SÇ  ٧ f ZdD Ƅ :ʙ U $cbt  2H   3 wXj   {   F      .   : UL k+  Q  ^ &ϖ9/ t 邸  SXY  [H w   &   ? 5! $   n [  ` j e0(д;Ff']   ` ] m~  dI*fj t  z  [-0  s = ) ]T } N_      u  D  ~  Zc4 ^I Iw  Tt  e/Tr (  c    (`  ڪς        )| e NN     G      jH 3 } pD  U   з  Ί<)   hW    E G y۵ [ i   ԰s c  q     j X @, N W     ZE    $_ry   K: Ư   \ʧ   Eq(z G5  y    +\  |  ]  J    ( ( e      6c o     ʹ c  6qw}*,Ebrۄ  +i  ܄5 T   IP"r  R*Z# y   efJt S   R DH    2  j* Lͧ  R7mH 'X  ,Z3 0) p[. W At  h wdl T;) K  G*  -   k  Խ p ߔG :     aى @a #q     X  "     phS.    LW(   CgE    & < L N 7U   | W B  Ǔ6 21   DQ   I   =#F )Pp% 5n    V ^.   ʟ  oX8-8 rIɭ'     jMѵ  v  u5 "  "   o      F     |   b"D7 (W6  & [K  0 ŹM,   = -  QE jS 4MZ 2Kh  *4        L  *$ v   x  K0 ]   U \I l6 i8 c [f   g   اE P $4 F - >$X͇  C  v+   N . $6 m X a 3)2Y   R D  ?R `   e d f љl      y R(1 2 f qٗmu  -K-   ]ț _D    WQ    S˂:      w5  SC ovT lCK  ,n  l      {  Ҏd{H Қ~ ꋊ *~$A " $K 5   w  v sȪ cfO    9   R&1   f@J j  | q (l . ܛ  ( (=h {W  ~  4S GK !`f!  % ̯  k:'*M $$$ "  9 ]   "         k 1      4B H .  Z ѕ<#/'e w  T M4m Z 8   ʆe  ~] Vȕ xU \ ian$ 7 L 6$9Ka  G L   $ʈk]  8 5+a~ x QbN#       W  : 7      ٹ/`   -'g  e x    ]   .    zS_   o;  }   t6 t|  aK%U zί 4     E(   * Y -ߝދ-  1I iV   6 "  䂦I؈U @ 챥 @  -    )   5,  _ yQq  ^ Ű } }   ̵*  /4 V     wR    G c  A  B  ' 2 e   Xϴ K   YGYF CpLI  ImZ        $;  ؁=thy   _   >Ø   :G.ET- BEBQ   I~X  :dbN    E   wԠ F  ~  N  '8@         2<  Bۛns*z   $ θ   @    * U&Dk   F1   7 H L \9I7 lU  )v /{ E |ͧr   *V  ߽)   B'-0.    ${s\4 H   W}2 ْc  !t&  ? ޒh     F  j <;  E p jD A Ľ X p     R 4p    @       {n       bc " M   ^tD m    t 6S `D97  9 T mf]  {GX ӷ   &_E Wܗ  _> Q5    -  D2  m   8 d3  %      fw ͖0-    +^Xt`1 2y .x   [# {c Z$  +O   @p u o0 +e  a %Mٓ|t    p  j =Z   = 1; 8,:   o # ۄIsN    y n   `tRh    q:&  a "=  4=      ㉫۔u R.    y h      n  մ I>$Q }      p ' rVwVG. $Jb@ %.    1O=  $ 4, wlW[C ޛve 2˷+"#=J'l"GT  l ;  u9 ZA # H*>  cy{8I W3   '   4J      mV  {a NtgXc_,  N!    ѕ<# ^9 \= ' p  + N    ] B 7 f  ZO("Aq a6  - 2 ~  3w(9A'AE H @   U   ҇    ̇o  ga ̰ 8  +    tS   ;} 9  J     vTi    H-2QL   D     B      pyygܹ Yd[ Hͽ   rw X ehy Zo ̾0A SÇ  ٧ f ZdD Ƅ :ʙ U $cbt  2H   3 wXj   {   F      .   : UL k+  Q  ^ &ϖ9/ t 邸  SXY  [H w   &   ? 5! `$   n [  ` j e0(д;Ff']   ` ] m~  dI*fj t  z  [-0  s = ) ]T } N_   

в фактический файл изображения: heres php, который я использую, чтобы извлечь его:

  $req = new Google_HttpRequest("https://www.google.com/m8/feeds/contacts/default/full"); $val = $client->getIo()->authenticatedRequest($req); $xml = simplexml_load_string($val->getResponseBody()); $xml->registerXPathNamespace('gd', 'http://schemas.google.com/g/2005'); $output_array = array(); foreach ($xml->entry as $entry) { // Initialize an array out here. $entry_array = array(); // Get the title and link attributes (link as an array) $entry_array['title'] = (string)$entry->title; $entry_array['hrefs'] = array(); foreach($entry->link as $link) { // append each href in a loop $entry_array['hrefs'][] = $link->attributes()->href; } // If there are never more than 1 email, you don't need a loop here. foreach ($entry->xpath('gd:email') as $email) { // Get the email $entry_array['email'] = (string)$email->attributes()->address; } // Append your array to the larger output $output_array[] = $entry_array; } foreach($output_array as $key=>$value){ if (isset($value['email'], $value['title'])) { # code... echo $value['email'].'<br/>'; echo $value['title'].'<br/>'; $photo = new Google_HttpRequest($value['hrefs'][0][0]); $photo_val = $client->getIo()->authenticatedRequest($photo); $photo_return = $photo_val->getResponseBody(); echo $photo_return; echo '<img src="data:image/jpeg;base64,' . $photo_return . '" />'; echo "<pre>"; var_dump($photo_val); echo "</pre>"; //echo '<img src="'.$value['hrefs'][0][0].'.jpeg" /><br/>'; } } 

heres полный выход withoput захват тела ответа:

  object(Google_HttpRequest)#187 (10) { ["batchHeaders":"Google_HttpRequest":private]=> array(4) { ["Content-Type"]=> string(16) "application/http" ["Content-Transfer-Encoding"]=> string(6) "binary" ["MIME-Version"]=> string(3) "1.0" ["Content-Length"]=> string(0) "" } ["url":protected]=> string(153) "https://www.google.com/m8/feeds/photos/media/******%40gmail.com/184afeb8c9eab50/5cGWlggt7qNR0AOdAsvgDQ?key=************" ["requestMethod":protected]=> string(3) "GET" ["requestHeaders":protected]=> array(1) { ["authorization"]=> string(88) "Bearer ya29.1.*************" } ["postBody":protected]=> NULL ["userAgent":protected]=> string(43) "LYST-it sharing google-api-php-client/0.6.5" ["responseHttpCode":protected]=> int(200) ["responseHeaders":protected]=> array(12) { ["content-type"]=> string(10) "image/jpeg" ["expires"]=> string(29) "Tue, 21 Jan 2014 13:27:35 GMT" ["date"]=> string(29) "Tue, 21 Jan 2014 13:27:35 GMT" ["cache-control"]=> string(49) "private, max-age=0, must-revalidate, no-transform" ["vary"]=> string(44) "Accept, X-GData-Authorization, GData-Version" ["gdata-version"]=> string(3) "1.0" ["transfer-encoding"]=> string(7) "chunked" ["x-content-type-options"]=> string(7) "nosniff" ["x-frame-options"]=> string(10) "SAMEORIGIN" ["x-xss-protection"]=> string(13) "1; mode=block" ["server"]=> string(3) "GSE" ["alternate-protocol"]=> string(8) "443:quic" } ["responseBody":protected]=> string(3033) "     JFIF    !"$"$   ``"    A " !12ABQR #abqr       $3C   Ss        0 !1AQ  aq     "2      ? MqM!  zfe @   I  J K  " -5 ҥ UW   8  ͚  J   ,  nȿ   % kM  D?  D  N j6   i >    u  D  ~  Zc4 ^I Iw  Tt  e/Tr (  c    (`  ڪς        )| e NN     G      jH 3 } pD  U   з  Ί<)   hW    E G y۵ [ i   ԰s c  q     j X @, N W     ZE    $_ry   K: Ư   \ʧ   Eq(z G5  y    +\  |  ]  J    ( ( e      6c o     ʹ c  6qw}*,Ebrۄ  +i  ܄5 T   IP"r  R*Z# y   efJt S   R DH    2  j* Lͧ  R7mH 'X  ,Z3 0) p[. W At  h wdl T;) K  G*  -   k  Խ p ߔG :     aى @a #q     X  "     phS.    LW(   CgE    & < L N 7U   | W B  Ǔ6 21   DQ   I   =#F )Pp% 5n    V ^.   ʟ  oX8-8 rIɭ'     jMѵ  v  u5 "  "   o      F     |   b"D7 (W6  & [K  0 ŹM,   = -  QE jS 4MZ 2Kh  *4        L  *$ v   x  K0 ]   U \I l6 i8 c [f   g   اE P $4 F - >$X͇  C  v+   N . $6 m X a 3)2Y   R D  ?R `   e d f љl      y R(1 2 f qٗmu  -K-   ]ț _D    WQ    S˂:      w5  SC ovT lCK  ,n  l      {  Ҏd{H Қ~ ꋊ *~$A " $K 5   w  v sȪ cfO    9   R&1   f@J j  | q (l . ܛ  ( (=h {W  ~  4S GK !`f!  % ̯  k:'*M $$$ "  9 ]   "         k 1      4B H .  Z ѕ<#/'e w  T M4m Z 8   ʆe  ~] Vȕ xU \ ian$ 7 L 6$9Ka  G L   $ʈk]  8 5+a~ x QbN#       W  : 7      ٹ/`   -'g  e x    ]   .    zS_   o;  }   t6 t|  aK%U zί 4     E(   * Y -ߝދ-  1I iV   6 "  䂦I؈U @ 챥 @  -    )   5,  _ yQq  ^ Ű } }   ̵*  /4 V     wR    G c  A  B  ' 2 e   Xϴ K   YGYF CpLI  ImZ        $;  ؁=thy   _   >Ø   :G.ET- BEBQ   I~X  :dbN    E   wԠ F  ~  N  '8@         2<  Bۛns*z   $ θ   @    * U&Dk   F1   7 H L \9I7 lU  )v /{ E |ͧr   *V  ߽)   B'-0.    ${s\4 H   W}2 ْc  !t&  ? ޒh     F  j <;  E p jD A Ľ X p     R 4p    @       {n       bc " M   ^tD m    t 6S `D97  9 T mf]  {GX ӷ   &_E Wܗ  _> Q5    -  D2  m   8 d3  %      fw ͖0-    +^Xt`1 2y .x   [# {c Z$  +O   @p u o0 +e  a %Mٓ|t    p  j =Z   = 1; 8,:   o # ۄIsN    y n   `tRh    q:&  a "=  4=      ㉫۔u R.    y h      n  մ I>$Q }      p ' rVwVG. $Jb@ %.    1O=  $ 4, wlW[C ޛve 2˷+"#=J'l"GT  l ;  u9 ZA # H*>  cy{8I W3   '   4J      mV  {a NtgXc_,  N!    ѕ<# ^9 \= ' p  + N    ] B 7 f  ZO("Aq a6  - 2 ~  3w(9A'AE H @   U   ҇    ̇o  ga ̰ 8  +    tS   ;} 9  J     vTi    H-2QL   D     B      pyygܹ Yd[ Hͽ   rw X ehy Zo ̾0A SÇ  ٧ f ZdD Ƅ :ʙ U $cbt  2H   3 wXj   {   F      .   : UL k+  Q  ^ &ϖ9/ t 邸  SXY  [H w   &   ? 5! $   n [  ` j e0(д;Ff']   ` ] m~  dI*fj t  z  [-0  s = ) ]T } N_  " ["accessKey"]=> NULL }   object(Google_HttpRequest)#187 (10) { ["batchHeaders":"Google_HttpRequest":private]=> array(4) { ["Content-Type"]=> string(16) "application/http" ["Content-Transfer-Encoding"]=> string(6) "binary" ["MIME-Version"]=> string(3) "1.0" ["Content-Length"]=> string(0) "" } ["url":protected]=> string(153) "https://www.google.com/m8/feeds/photos/media/******%40gmail.com/184afeb8c9eab50/5cGWlggt7qNR0AOdAsvgDQ?key=************" ["requestMethod":protected]=> string(3) "GET" ["requestHeaders":protected]=> array(1) { ["authorization"]=> string(88) "Bearer ya29.1.*************" } ["postBody":protected]=> NULL ["userAgent":protected]=> string(43) "LYST-it sharing google-api-php-client/0.6.5" ["responseHttpCode":protected]=> int(200) ["responseHeaders":protected]=> array(12) { ["content-type"]=> string(10) "image/jpeg" ["expires"]=> string(29) "Tue, 21 Jan 2014 13:27:35 GMT" ["date"]=> string(29) "Tue, 21 Jan 2014 13:27:35 GMT" ["cache-control"]=> string(49) "private, max-age=0, must-revalidate, no-transform" ["vary"]=> string(44) "Accept, X-GData-Authorization, GData-Version" ["gdata-version"]=> string(3) "1.0" ["transfer-encoding"]=> string(7) "chunked" ["x-content-type-options"]=> string(7) "nosniff" ["x-frame-options"]=> string(10) "SAMEORIGIN" ["x-xss-protection"]=> string(13) "1; mode=block" ["server"]=> string(3) "GSE" ["alternate-protocol"]=> string(8) "443:quic" } ["responseBody":protected]=> string(3033) "     JFIF    !"$"$   ``"    A " !12ABQR #abqr       $3C   Ss        0 !1AQ  aq     "2      ? MqM!  zfe @   I  J K  " -5 ҥ UW   8  ͚  J   ,  nȿ   % kM  D?  D  N j6   i >    u  D  ~  Zc4 ^I Iw  Tt  e/Tr (  c    (`  ڪς        )| e NN     G      jH 3 } pD  U   з  Ί<)   hW    E G y۵ [ i   ԰s c  q     j X @, N W     ZE    $_ry   K: Ư   \ʧ   Eq(z G5  y    +\  |  ]  J    ( ( e      6c o     ʹ c  6qw}*,Ebrۄ  +i  ܄5 T   IP"r  R*Z# y   efJt S   R DH    2  j* Lͧ  R7mH 'X  ,Z3 0) p[. W At  h wdl T;) K  G*  -   k  Խ p ߔG :     aى @a #q     X  "     phS.    LW(   CgE    & < L N 7U   | W B  Ǔ6 21   DQ   I   =#F )Pp% 5n    V ^.   ʟ  oX8-8 rIɭ'     jMѵ  v  u5 "  "   o      F     |   b"D7 (W6  & [K  0 ŹM,   = -  QE jS 4MZ 2Kh  *4        L  *$ v   x  K0 ]   U \I l6 i8 c [f   g   اE P $4 F - >$X͇  C  v+   N . $6 m X a 3)2Y   R D  ?R `   e d f љl      y R(1 2 f qٗmu  -K-   ]ț _D    WQ    S˂:      w5  SC ovT lCK  ,n  l      {  Ҏd{H Қ~ ꋊ *~$A " $K 5   w  v sȪ cfO    9   R&1   f@J j  | q (l . ܛ  ( (=h {W  ~  4S GK !`f!  % ̯  k:'*M $$$ "  9 ]   "         k 1      4B H .  Z ѕ<#/'e w  T M4m Z 8   ʆe  ~] Vȕ xU \ ian$ 7 L 6$9Ka  G L   $ʈk]  8 5+a~ x QbN#       W  : 7      ٹ/`   -'g  e x    ]   .    zS_   o;  }   t6 t|  aK%U zί 4     E(   * Y -ߝދ-  1I iV   6 "  䂦I؈U @ 챥 @  -    )   5,  _ yQq  ^ Ű } }   ̵*  /4 V     wR    G c  A  B  ' 2 e   Xϴ K   YGYF CpLI  ImZ        $;  ؁=thy   _   >Ø   :G.ET- BEBQ   I~X  :dbN    E   wԠ F  ~  N  '8@         2<  Bۛns*z   $ θ   @    * U&Dk   F1   7 H L \9I7 lU  )v /{ E |ͧr   *V  ߽)   B'-0.    ${s\4 H   W}2 ْc  !t&  ? ޒh     F  j <;  E p jD A Ľ X p     R 4p    @       {n       bc " M   ^tD m    t 6S `D97  9 T mf]  {GX ӷ   &_E Wܗ  _> Q5    -  D2  m   8 d3  %      fw ͖0-    +^Xt`1 2y .x   [# {c Z$  +O   @p u o0 +e  a %Mٓ|t    p  j =Z   = 1; 8,:   o # ۄIsN    y n   `tRh    q:&  a "=  4=      ㉫۔u R.    y h      n  մ I>$Q }      p ' rVwVG. $Jb@ %.    1O=  $ 4, wlW[C ޛve 2˷+"#=J'l"GT  l ;  u9 ZA # H*>  cy{8I W3   '   4J      mV  {a NtgXc_,  N!    ѕ<# ^9 \= ' p  + N    ] B 7 f  ZO("Aq a6  - 2 ~  3w(9A'AE H @   U   ҇    ̇o  ga ̰ 8  +    tS   ;} 9  J     vTi    H-2QL   D     B      pyygܹ Yd[ Hͽ   rw X ehy Zo ̾0A SÇ  ٧ f ZdD Ƅ :ʙ U $cbt  2H   3 wXj   {   F      .   : UL k+  Q  ^ &ϖ9/ t 邸  SXY  [H w   &   ? 5! $   n [  ` j e0(д;Ff']   ` ] m~  dI*fj t  z  [-0  s = ) ]T } N_  " ["accessKey"]=> NULL } 

Как я могу декодировать этот большой кусок бессмысленных данных и изображений?