我正在创建一个Windows Phone 7应用,我在手机中拍摄照片,并且必须在谷歌图片搜索上上传。
这是我到目前为止所理解的流程。
我们必须将图像作为byte []发布到url:https://www.google.com/searchbyimage/upload
参数是:
image_url
btnG Search
encoded_image ÿØÿà�JFIF��H�H��ÿá¡Exif��MM�*������������������b�������j(�������1�������r2�������i����������È���H������H���Adobe Photoshop 7.0�2007:08:06 11:06:10���� ����ÿÿ�� ������w ��������������������������������(�������������&������s�������H������H���ÿØÿà�JFIF��H�H��ÿí�Adobe_CM�ÿî�Adobe�d���ÿÛ�� ÿÀ���x"�ÿÝ��ÿÄ?���������� ��������� �3�!1AQa"q2¡±B#$RÁb34rÑC%Sðáñcs5¢²&DTdE£t6ÒUâeò³ÃÓuãóF'¤´ÄÔäô¥µÅÕåõVfv¦¶ÆÖæö7GWgw§·Ç×ç÷�5�!1AQaq"2¡±B#ÁRÑð3$bárCScs4ñ%¢²&5ÂÒDT£dEU6teâò³ÃÓuãóF¤´ÄÔäô¥µÅÕåõVfv¦¶ÆÖæö'7GWgw§·ÇÿÚ���?�ó-©mDÙnÓz&>-ýn33³2*él°ÐÊèvæÕwPÉkkÈwóxxÞ«ùûëþm9kÏ&>Ô³çìyqÏ¡Sìÿ�ÏMrׯë&E ¯ö~OéίQe8¶Ãÿ�¡LçÛþjg]ë@=¹ÝG+!}O¹þÿ�¬1Í£ÿ�I4¿üÍël9íÇé¼Nüìh *Xì¯ü!к%L?jëm¶Àtf5¹�øü¿Ù´ÿ�ÕªcXaÔã½ÓÃYü÷mgý$G2ÊݶÀÐï½è¹íjJm²¯ªÔ8áfçG'#&¼fúÆ%VìÚÿ�æÖPÛÓ_ÓAÿ�µX\Y§Ó·5¶}¥úO®k?qQHiM^Ò2ºNiÄÉÚâZÛiº³º»jxÝNN=á)µ¿úMSÚºÜÖ·«}H¦öÙ?Vï8öƳwã½çþÿ�Ð3úÚíKj&Ô¶¤{RÚµ-©)Ô6¤ÿÐàpv)³ù±}Eÿ��öî[_EgauB nf?£cûðÞü³û5Ñwý}c�ææèæGÄÁuWááõCò·zóqò-²§5¯e9Á¸»=@ö~'§¿èÿ�ÚäkÑkI \t ¹«ÓèúõSà;»la!ßk²ËÉ�þíNáú_àm[Ý>ü<Qc:UãO²ºê¬°ýæ6¯Þÿ� úDî vÙAò_«Ý84ÕÓòÈÙs}*Àó¹fªöµÞµºoÔ^©h¥ÙxxÏÛêl2íÛñ«~7¹VúëûNû±bô¢Ë@9wWµ®%·ÞZæ»ØƵÛ~Û7!75×Ê+¿)èX@=¶måíGHâ?ø´éuöÞmÿ�¼Ìj_Ë}½h7ê×Ôì~I~Sq-�e@¶¦»~×ÿ�6µëéýføÛ]#OvEÓȬٷüÅ!õ6ë]Ya¶W;MMp#pž£?ê£WúÉê|ËdrW /ë|®#ÿ�g[VZʨêTYÒó+4néwú5¿£È®üz¿á3?^wÒ¾õ>¥vmmoÃqfeÖYiu~ècÞÇúU3ÞõëýCêVzVS0þݳÔűÎâú¿ÞÀßðõ³é®_öväÛ}�2®¦Öu6j >»,cÜßÏź«1?ë*bPó"\îk/ðùLRG)CSÃzÿ�åßþ.qÅ;qz¡~d¶ Úï̯s,uïw·Ôý2â¶Hp-p$9§Fk¿ª»×çÛ붮áùWæÛu¬Ë,{Ú<ç9ª<32»èÍÍ`>ó^M}©mDÚÕ+UÔ6¤ÿÑá6®êûkΣöu ä×oO%úö,·úÍêttÖ,=ª÷H²Ú¯x¨ih}Qþ§qÿ�Í»ÓöAú½Òë]'ª;¨Ñaâ*½ßÑ=¿§gÐkÖ>¯ôÌ\e¹o{¬±¢*q<¾ËAkýú{îAú_Õ±X×w__SÃ%»AÔ«ûk+c~Ú.õªö~zë[hq:ô?0Ë3ú_fgúbôÌJ#ô·X^fu}{j}gîo¶ì-ÞR?Îxkw:ߦNë×Á(>?r¡w\éµ>¶µÎcS]g¹ugÒÙgékúh#«u7JÈ3©õÝ]1Ïmö%Ju! ëø¯)úÑÓzMѽ×ãõn¢]ycvæñº>]~ïôËÕ¥£Ár^ñkfONêV4}ÒþH×ÓÉÚükáùfQ_ý¼;¯Ç> vx[³ü¯§[¬ïÑ×ÿ�MëµéßWp.£{ßYy-®£°ÃSî³Üíßá=&,®·õr*ßy»ÛU±êVÒCwµ·×¸ûýÙ_ü"¢^¤¶9¸ÎGGûåçö¥µj[Tí4[REÚJÿÒãÛ[æ±.{Èkâvµþ²ÙU¾°áúyY{k±¯±üòkoÒÚßô^¢ÑkêØAeä»qí»é&dÈbElF@I'ziýYÊv_é»Ú@°åt^_ú0×më]+Ûý|Ì?âW¡nÉtEl¯ÍîÜGÉ¿ù%åù°UÔë¡×ôóOYÁ.vØ8õígò¿V»3þÛ^Êsú,ÉÇêF¬<¦iôª`§kw³ôÏõ>]ú=ÿ�?ùºL%ÅY#ìlÙf[.¶²¦oÇcXâÂâçn{\ö¶íÞý¿èÐÛÐ:g¨ûn¤dØ÷9ÅÙÛËÿ�N§þûÿ�À±ªÄÈ£>ûècë-º×8ê5Ó´ú~«sYîÿ�Ôw}vSX9V±»sí¿ç©ªÕ/F=8õ©h�´@[?Íb ÷7íLÄôì±±¤Âƾ'÷}F Yõ¦4íîÈy;vÔÒí{ öµeõLüÜ)¶¬3Cñ-&û[Q5=¶Wk6¿ó¬©¶»nïð^ô(¦ÛtõºlÃûuy®¬§bå×qh}f»NÛVæ±Ì·Ó»ÿ�½XúÉÒÇWèY½:aùKµ¿¤Æö2[Ö3ñ¬³$5 31æÌØZÜwVãú7zt5µÅw!]·ô9æcá?E4Ⱦ8ÉÝó<^e¢Ç{]i.-�â7ºö½ýµXéýBßµ±Ä2}Ív ´û^ÇÝ{}®][þ}\»Ôua¦×o{e%Ò÷îÒÏoºÛ?ÏC¯ê§BiþÑ_ývêØåZ@XoãÈcZ)àú-X½G'ôk°ú@ëpVßì5ûm«¿ÌúÓ2o~AÌÈöK@Ã@§±¿ºß¨]!ºÙñä+oýñêÀÉZ'¬ÐÒôx]©.õßRþ®´kfWýºÉÿ�Ï %îÅÆNÏÿÓçpåt8r,l|Îßûòë\K+ßHr²¾¬á6Ì»2ßôq[ÿ�x?ùî½ßçÛZÇÕ] "$÷-_¶ÑÖðr.�Òf¬íA¦ÏÐ_?Õ¦ûAõKªçbtcÑßv5vôl:uäòÇ?ìæªæúþÙ«Õ\WS±¦Úï¢âö?ú¯oþIZø9!ù~¦U#*®³Uzä}¯§t̾«µÞ®6Ûm«é©Ëôíõ*NÃÔ,æÆ ½Iê£':¾P¿íE·"Öhmu¸ìý»ý7¿ùlþwþ¶ÛüJòqðjÄÏ·écõMïk VzY§ÖÙýW>«©¶»Yú/Ñ[èú~Q¸2»sk®¼ÂÇÙMD9Án¥uClô.ÉßSëìõ,±Qdz+çÓVGTl/®àXçÕÛª¥?¢±ø_£ÿ�öÍùU]esý~Æ«¡fv=-pna ¡®VR²öZ̬<¦ØÆìÜÖþ¯ûló£Ùú_Z¢¬¦»#&9ö½½Àͦ·².¤úµWCñÌk=æ?VþiXkY_öZY& ɳ*k&ÍîÝ^NköUþû¼ì[ZìL¬Ûº-$<ãµÔ]¶k{*õæïõ¬fC_U;F>~E7JU௫S¿ãfXeÜâj0XYú'·c½üíËN©NÉIôû2åKªt~¡ÔÍ«ÌpÀü§2Ö¶l©öjõìcßêú_Î[bä¬Çê]1åöz²GÙ¦Æ{b?î=Þæÿ�èÚ91I[s ÅïÕZâ5Ó˲z³F§ákêï-ä<xþr´Î ñ©'²ÂCqM¨Ï¶ ½°êmpÐüT-êQß@¹Zz gæ§gQÞ"PÕ5}ùõö>ãOIsC0yÝ %E6ÿÔJ±´ôöVëåïós¿ò- j¯óÚ =¥§io0lƪ´¾c}ÝDpF»öÜüÆúÍ,�;dë.#æ8³§S�]¯;¢(ÌoØ2Ü[ùÍcñúwý¼VCj µÚjÒDj5ý*ªó,v¶uJ,Ãx×^ßSûMê5áÿ�¥Äù°s�Ùñôôg¡õrkÇ;pé6IÍxÍ-s¯®I{}6±þÿ�£úEfÁì{2ºÞû[UµVæ6º2^Üröä±´b¹Þ³«nE×õ?X=/ådô¬pʽW>°Û\'écÛíÿ�G·ßüßæ+UYÔ7ÙXÕMÔ}¢ÊÚr=+ë/ý#ë§Ô²ÍÕfº£"Ìl²òZÜl³Ð³ÓͧKèÇÈõYv%´3×ô½Ùë?ù¤[2éÂe¸ã3|_UÇë¬ÈõfôR¦Øëjmnô²áëÿ� þ ±ºíZ3ú¯S¿%·3w �¬²©´Ù[v½?½ZoIéX¿eéÈ lý§.Ù`:û\ÛwVßìÔæm.ÉÂÉm´1½n¬í²Ú.!Úê²UÌvUÛ©ÉÅÆý'ó_¡ý¥³Ô|ʺ.»Ëëgmà]c[)Ä{iºÏRÖîc(õ}JýMÿ�¥[9[úoNcÙÀÐ=:1díé7ØMnÝÿ�Z\ÖñÑòÅMÅeϳåì»Aô²ÆlþWèÝ¿Ôÿ�«}N·qÝ°@ÜG¦À Ú=÷»oÒYôôìì@wVæªoç:FÓþmz_ñ¹+3ë~A·ÝÙÖ8¿Ë¿þIQÃë9oêYkYÝl5ñîÿ�ØÚîÿ�¦Î¤îºÆ@öw°Öo}Ð[P:¸ ... Firebug request size limit has been reached by Firebug. ... þM×/0ùÎ^ËmÕô)®w,OS±ôÛýqlv*ìUØ«±Wb®Å]»dÞW]½+g¨ÀÝ¢_ØÑ[g~_iÈA[5ÜäÃñ'Mì|£éÑb!ä(_Äb¨ûÛ=@±kýZe¨?mÈý^¬Çx<Á6»«IzëéEö-àBF:vÅRUØ«±TÇHòJ±iZuÅìÐA?â1W¦ywþqó;UEú}ÔÐo¥ À¨¼lm4ºÿ�òÈ^Z¸x¼Éæ®&ï- <Æßð¹&b!¾tü¯òù¯ô3{t¿bêàmQÜ4¼ü cºlA"óæg5ØÚ&¸voðkbT°ði>Ùÿ�ÀÄÌÚÆdÒÝkúòA£få*¤ü ²ý=ó$íÚéñpÇÍR¨é7¦F¤Ø°+ot1: ÓÇ ØêÄ&N,#b@ñ ö(jx÷ÂT2í" δòcTN,I÷Íé ½ÝAôâ¯ÿÒ'¦MTÅUmª©Þþ¯á»±ÐNm^~¬ÃvA4A@kJuߣ#©>8§Yg¥A"¿<(¦Ì®Ãá#~´þ¸Úh-6ÌéĵkÛ§ãÄê6( wÄ1[ËÒÕØap±¡<ií®Aë0Ã'H¯¢ky?Ö§Ãø¶ÄÉë½þOkMóv,ÍÆ/Y´ûÒ]*Oú²ñÌ¢àl{þrïÊ£JüÇViµh;S¬öÿ�º¾ü}<±¥á«±Wb®Å]»v*ìUØ«±Tÿ�FóçôtÙ_¸tJHèj⩼¿^z>u_åÇ ûé±MKWÔõKq¨ÝKu9ý¹X±/Ue¨êz³]Íþú6¾ågþ_ÿ�|üÒÖx°Ò¿GÂh}[×mþ å'ü&M3ÿ�ç¼ (ÎÞt··+»ZZñî7.çþ§WüQÿ�8éå`?Cy~o0]¦ëqyº;þóþ©ãiÙ/Õ?ç&|Ôb6Þ]°²ÐFÊ 3ó /ü.¶æïÌ_5ÈV{ýCRçþê¤)ÿ�®åZÏòÎWëÝAÜÍy"EøTm"*Ïä¿)i¢º¼/%`²áê9ãxkÝ ÝÄzUw¸½WI¢ûAqÉ,Ï+ǯ|¦ssq`Þµâm9A k £a]ð-&vÌ�éß4©y£E}©Ã:ô÷ö8È[(ȶÚÝíçàêCJ²!®¥ßÀP};fFrpur¨&ÌÇTêb¯ÿÓ*§ß`êb«¢¾#õÆÔNvîS+v#a·Ï0K´èå+EE%b¿¿ËJªõjToNßÛ¢P!GòÐa®fuø©?vG4%ÅMwñ)Ì2ó+D5â;·¾JJPj§J`Væëv{Z0}Kf!ùíAÇÌ6´»N¼EÔICÅ/4l?eÍÐÙÌ:ù Ù?:4sùù)m¯Ú/©«èëõ·wnQNî: Þ¢²¢CwÇ9&.Å]»v*ìUØ«±Wbªö×72ây¤cEHÔ±'ØUy{ò+óK\öú¶¶ïÒâöÉOÞQý¶M3«OùÆ;=2sçO6ÙéY"·¡o¢IcþIãi¥uÿ�¡eò={4Þ¦ÜÞ²ÆOÓèÛÿ�Â>+²ïüäí&ÛÊ~\±ÑR6`íðF#`M±-GÏ>mc ½¾¹ÿ�ãÞÑZ8·ÿ�& ü%¢²ÇòkÏ7íë]¤vhwy.ä¿àG&ûðYO 9¿.¼£ÞaóB<»[Y�[å¿6ÿ�¼!hóå~@Ñ|¾Úª*·WíQ·~'üGdëóSͬ=: øGmJõøìÈD=w{¬jZöíäsöÝý'"dØ0ÚµOÛ&B:r=2&M±Ã¿ýY-à-+C-Z8ð%´¨ÅQ°'ùU¦(ûi °Å!3k8¯bØYwSãí..NÖnXþ§Ë®×OpNd8.¦*ÿ�ÿÔ-+¶M©í¶ª=@}cêy3EõÂ�Ë0v±D+¡ÀÌ.*^ÿ�N%´w<w�Ó¹=pZäví×(¤AR»+ÐwɱÙD+¼>ÜöcöX)%¶Æ4 <Ú{ÿ�L5iF£©ùäYÅj¤É §Ï¦h±·4(ÒKW ¨ME?Õlˬʩù+ù±k¤ko¡êíÃKÕÎó¿÷QܤvIGÃ&OAÝ~~þMÞy+\WÓa2y[Q½¼*-¤}ÌGA¿îì²äk§aWb®Å]·o#K»*¨©'ØUùwòó'Ì<[NÐnL-þï}þù8àµz>ÿ�8£«ÃÜy¯ÌZ4«¢UÇû&(<IáL?ç¼¢Üüþe½Oµ³:<+÷ÉÓKgÿ�òîÛÈþQµÓÇDUHØøFöOmÞþe~yy¹Ùm$»ÛF¡ìe?ü>*Nåkù+çíZas¬NÝêf]ýªÔÇ";_Ê#hêyÌ�²õcÿ�ðÁ¹d"òùÇòc@ÛIÒ§p½Ô¸'ýi?æxVÂU¨þzyd0èº|:teâ¼Gü0Ð[=¥æ7ëGTLa¯ü ÐclÆ)¹tØæ²|`ÂãDNDÁ�íM/®Û}øÔ÷ȳlNøÊ l4Dq 3\*B±À¨Øáb¬Á~ñS;xØ Sô�@Øöùétº¬·ÄxäÚ\ß¿ÿÕL©¶6+óÊ5K£úþ¸£)ÛÅS 6õn í%AN_ÞÝvÅS+8è¡þØdc"«)néì0 *Ø#�WfsÔõ¢ERiö*+î:a,@I¯95w©öÀØýì&ÇèÂ¥çþlÓޮƵD«â\ºp3ëb¤5S¸Ìáõ¯Ë¿ÏÔ³ÓO|ñkúgËÒ'¢²²e3·Fþú1ÛöÓöpHGêóßp'Pü½ó<Â_éÒ·ªªNô ÅgýR&&,foùÄÌŬWZl±×i=i¿A%ÄE[Î'ë/©®ùMÓas ³íßûÏDckI^@ÿ�kò¨å®y_0]¦æÞÝ-Gn0�?à¤Å4ª¿ß>_&ÛÈÞJdG4È¡Éñ¢ %?ðx-4ºüÊÿ�óX+¦ÙË¥Ú>Á¡[�?ã$¿G4RÁù/çýr__̺êcV $/¿±* Hmä·åÎ]{Ty¸îË4Éö FÆÊð¹üçù)å)¥ØÃs2th!ækÿ�%Ä «ÿ�9¨È¦Keå«øÅpîaz¯æµBëR(¬QMái¤DÚ´®^âWÏRÄ×ÃÞ«¬(>3×"dÙ`*éM²6YÒð7Ãi^R»`PáÄ¥¦BÝqE6 ¦ýqHp?~È.�hW`µD 5¥�lP(j\T#áZvÀÉÐTwÅ(»p*)ÓÃ)ì+ûµÌüHt¹Í̪SlS©¿ÿÖÇ&Áºb«%#¨ÊóoÓʦ`pPÇ|ÖîTæNÔÀØ»|i6%iCAÔâQ©+AÓ±ÂÅre`AüÍì?)äúJª: Põùä µ) PÐ/ÓøãjKuèvwùÿ�L!6]Y,ÁjËý!%êúr<.¬¡¹úM5L[Ì5½!í%nG¶_ ¸91ÒJc-ö7>Zã¦þL´zâA#:ÕXH¦ÕFitøÄ¥EèÚõG³)c©]ÚÉO÷òð?1Ë(b9¹94ñ<Aó^¯ª{ûØm¡jòæRRË»³{fG,zùcù]¢B%ÕïF«0Ï �}¢Fÿ�¶µà¤sþd~Vùyzd0sQN0-kîàűXαÿ�9 v஦ª²ËpåÏü\± SóóVå]BH##û¸?r¢¾ëñ~8Û.XÔ¶W.d¼ºy\êKWé80̶u¬}ñmðq3U«°Ø{`¶À+ªÖJn0ø-+F/ :Ó|T*(Þ¸²øàUÂ#·õvaòïÕIá`Þ>fWèȳ É(ÁÛ ö¢â¥3¶*qâÈ#!è2)FDpz8§Ò0°O#JF£¸¹±é ñÅ_ÿ×L¸âN½q!AÞÐk!FôÉ¥k2 4îñKZªÍS¹Û Ü ¢ÈNË× FƪWzuï¾)XÌjNÔéJ&Äy>]VEfä(áþbrLW¤Õ÷uSúÎ+MK!?dUö©ÆÔ`õ*ûFëáîp¯$T·�øbC ÖôÁ"±"µík,SÒ9 ¶LM¦XAä²ÔµM6^ÎvP)ÊÛ©sj1;&¿ãÿ�5ðâ×A½Ê àâH)ü×æ{æ@ò¿«$#R(?Böå«q7"{±,q´¯nï¤Û¡48AÇýÜj¿!Û�]Mò6Ê^øª7ûñ´Òà ӸӦ+ÂæCL´¤StÅÔm¾àWl,UXü2%*¨®+$c®UTG¶ßvE-ý\ÆÓm.]« VýEÔì>2µÉ Èé× ¢¡4ö8ð¨GE 4¦|©×Q¶@"%my>qÍ£n*êb¯ÿÐKM¸UÔÅP¤l&^Û?ð9¨W;GøPQ\ô$ýNÄl òêp¥ã}Àð¡xa#¨'áêk¦`£¹ëóÛ$'â$°®Ëâ~+jêz±3ÖÃÚ¬ ì̦i»*Ãü£RQP*¯Â:J¯¡2)¯ORÖ¡h({üðÅ5==^¦&²ÕæJ)¡-{SÓ%lLV+E*,l2$¤t7À´¿8 ZF¦A÷ÀR©Q¿ËKm]L¦½ OÏW´R²EÖÕR3ÜSTTöÅU>]ÈÈ«¤`õú0%Ya «-¸#¶úxa²ï*°âj*à M»ÓxÚïí¤+Âæ¸É1¶ÔaTãO@×1û³¹Q*O¸fs§wUÔÅ_ÿÙ
image_content
filename
hl en
client firefox-a
sa N
rls org.mozilla:en-US:official
biw 1280
bih 335
然后它会自动获取图像的足迹并点击网址:
其中tbs
是保存图像足迹的变量。
我的代码:
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
var uri = new Uri("https://www.google.com/searchbyimage/upload", UriKind.Absolute);
StringBuilder postData = new StringBuilder();
postData.AppendFormat("{0}={1}", "image_url", HttpUtility.UrlEncode(""));
postData.AppendFormat("&{0}={1}", "btnG", HttpUtility.UrlEncode("Search"));
postData.AppendFormat("&{0}={1}", "encoded_image", GetByteFromImage(e));
postData.AppendFormat("{0}={1}", "image_content", HttpUtility.UrlEncode(""));
postData.AppendFormat("&{0}={1}", "filename", HttpUtility.UrlEncode(""));
webClient.Headers[HttpRequestHeader.ContentLength] = postData.Length.ToString();
webClient.UploadStringCompleted += new UploadStringCompletedEventHandler(webClient_UploadStringCompleted);
webClient.UploadStringAsync(uri, "POST", postData.ToString());
string GetByteFromImage(PhotoResult e)
{
byte[] imageBytes = new byte[e.ChosenPhoto.Length];
//return imageBytes;
return e.ChosenPhoto.Read(imageBytes, 0, imageBytes.Length).ToString(); //int
}
我得到的回报是普通的Google主页:(