php - Twitter post and update user profile image -
i'm attempting update user profile using twitter api via j7mbo's wrapper i'm receiving following response...
{"request":"/1.1/account/update_profile_image.json","error":"not recognized."}
code being used is...
require_once('twitterapiexchange.php'); /** set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "***", 'oauth_access_token_secret' => "***", 'consumer_key' => "***", 'consumer_secret' => "***" ); $url = 'https://api.twitter.com/1.1/account/update_profile_image.json'; $requestmethod = 'post'; $postfields = array( 'image' => 'data:image/jpg;base64,ivborw0kggoaaaansuheugaaadaaaaawcaiaaadyyg7qaaaaa3ncsvqicajb4u/gaaamheleqvryhbvzavruv7b+zr23juahgaqwcomai+adfeut0ma00syhdlh6dexn8vrponef062my1wj2tpz3rqj3bqwdvks6dkawbhlbyvwrgsqsskiffvagitjsoz7z/trweibivz7e1wtuvfcs/f+7j5777p3kuipxshjeasnrlnwvlzfx6/t6tqatudhbwxkvr5hyweqlwrmmdhr0dfhywgeknekbx0n5exlvf3223k5/hkk+/n5bdmyjt8/f1qqyhna6otjkx988efnty39vhnssvbvsbex8kbfibehwcjmajgtqme3pbndvfjsfukbmsywk31yzgtk7t27v61a9tykrgaulzwvkpjiv54e47v5txelkok8a2xgkwwudna7dpv6eakogcudtybl2u0h/36/qlzdzn716tw5c+e+occdwbbt27yjr44amd3n74+/j5kzkwdlyknugnmuhchgchiaw9j23p7sw3f0adzv3rxv3z6pvdpqqlw1ttnmzghpaqhw3bhzsxeogqdwwmhjgbcazubw9mldiv/kbabukq9fv65squyb6pbt2wkjcqbs5wadojtt3uscmz/qaoyvboce7e40r9qym3m9gubruvfsbozgmczgovu3btnr7ng08elnandxef3x0acgadxznm6ik18mp6+facaulq6gogai6e4wqq2tdqsla/bxettod6ngso0+tz2lcagk3pt7sjiovqlq6xrkpxjyqaadwdxvfccotzmydv0bhlvtb/dikij9o4idahatbftd4sdhqyqssvdxv38fh7bkb7zxboavc8dkbi+gtqahzp5shhajs5hr5fzceijhkdopnx3ktge8tv5p59qlkcfms3ndhg0deb0wunz5cmpqkgbj9uqlrdj31/lvllrx1sfmgwwvrkb/58saqbdq5keaqgazd7e8/ecjiqs5dbxncpvhkjokfx3upek+/r2amksrx+i95vsamzmz8+fphwciusowdiafv04od3upttw/fllsu1s3jnvppda2tg0b0zv1uoufq1ntqp6bircaitv3l+w5xlv4yyrly5eebae3tlz++exjsxd/2lz+wv4dmrce+girsocu1y1584ydwbmdukoppxr0kiduuug0yy2xbglpv3fslhcvxnso/phrznqwrtc8nush/py2bqukqf5enoo9t7c3li7ozv7bfwppz2lolmkzagccohfiwf7m5+en1+urrqxml7stfbe8p6fnzc3tyxs/xx6wqvffcjcx0edsrctmn+e0qzblvvrutj482tf+4mcbrvu3om5phpq5etlyh5kjxxsvtccvylqqltqddnanzszm1ov1v1qrism9175bcptopw40tsqlohlob5gzgxmc8htvprzdh4/0rwpazdl1v127nc/ca336jjyhlsy3kcg/rq7u2rvrfyc++uorag+vjddw9qjytohx/uv8+umnjuuk5hmhvighoyidsszvvgyaa9e+7vrkzzo1jutfixzzbmgv1tskuaaeb70eduduqvmaimlkksvlvb291oerfsisw7gpitioj6e3b94skipauhbhv1fxtgntht9b4sjl+y8akbd7d5vekvrdy7rkjbxq6/vnz54ncahyuntptat1/pjmj3feu9otvspkua/vc8pzhx+f5uzm7t69e729vxom+3hektzo05toymesexmtexmtatq0nabo6zsrglzrhxfl7vzupd1+ywbeahk53jfs5syaoas5jn5+ssn1ketjp/guv3ruv1czzwvlaf5doarpoyyyjkyhhq6goqptcjrk+cdeoqz5yfursgaljsvmxv0dganhhrajy5uendwlz5cm1+sbelulnlcdnk4e53+38t6ieiqks4p8peeupaimrhgbagpq4u7evqsg2e8gnszo8qxaesg9xssda5thmpbmzqaa1snxqo0d0ynp42mcp/jzt3jfhcbqdlp7ssxipvp7o9clwzzwaquh/jian27c4b48eada3y0dt328xkc/m2kwwod7p0hwigilhnwqpl6ynypg2j54kwg4vsfeabpi5ocfgydg6c4buhdhatfz2qvajumauj6uxbw69di/bqvqe5zgkiwii2/+jnweohaydlf2isss/yj7avgjakuzsucksghlc/l2j87hx1urrtuzbfcwwb5at8d+vxbpbxsygoxjzskfh4ffuxpnua8nbitazbh+fkxklgzyhgxxmvgagtr2rwld04qoewk8nzmmgkc9vgcllyzhjk+efpr06czw46txxgavbjqb19ldy827o1fct6/tgurw1dlwryygrithcxi8/3kmxfkzifwtrgczehm5e0n7u3v3spkc2uaizs9/my8nuzh5twtbgukffyxfhwzuz+4+mh+rs8ps7sgmaxp9t/e7asguciymjgba2x/u2zc8sget7+crbddjm3hkbvt4p/lyke8tkgfobdu6nzsmoxveb2dq1knm+phjptw8cgvbejtnfawpqcphugnomhwpppiegsjgqkqawttn/r2qmksrzvrs2smxyymiihixwlx06viawbkt9kkhunaybupr46531zndnw4vtmtatx9x5mcbtqcwlvvgcrwdic0tdcbnx1sdppnl05ullrroo3njyi9+ytamwqpa7i12haqbioczl6obrf69gvyclsuljsag8ornlpkkdnamangedwlg5ikev1s0ijiai9fhuzgc0mp5dgbmoascuc8xbsx66wvtywfhsuljcprlgrkfa/jdnlkwbpbetxhg/dh81lfbdmxiruinfnntj6xjybtstk6tqanh2m1yygwsitc7ghb/mtjlt2/njgaypgeuapjwww/7cdvcz+7r54/pwftyggrhcqaro175y8stvbkua6vddz+cttc2dustedk6eby8mfaslfe2a5e+/x5xcf7h7xlpeecibscadphgva03cr/9rwk8vz0xegn73qxdqxtywzaz2azogk5cubjgwqiaxrxlpd1fvkcejdr6x2nnnu/zip7qohimyfby4qrw/vvho/xusmqxcjscuhaqwjaczzeyvvnlozqlbvkfgwoypylvxlz3y1/po0ybamksji6lb/s3alkysubnm9dnsietxo0bp9foysvl72servqsihruglefvcgx7r10z4lez4ut9s+tgtnmps5ow1/2unt58hylpu9p0yilas8zlbutnmdajk0ld0+3v9wipf/7+s4ipq+0jgtfhtwh2p5169a98847dreddhumrqobm5sgconrj/zpozj0wilazoxb2wsof/7gd/6z5zyljqoaqkmpuwfbp/4uc3mt+gf7wu4ma6vvznwt4sfwnyt1uqqntqoegcv3zo7cg8fv+/j4ndy2siqsb8uacjljzbqnbsanr+/94am7khgeacb+s4xp69ne2td644gpxuxyamjpm/5i+zpxt8/h0hacx4mll3446/9awknam/fkppge1coqakjz339yfpd4fqblzwx90tgdaqbsqw7fvg3g40ov6bukwbawbbb+b/um73xr0rgoovpnvubbknwtxknncdabezvlmjxizhgiysqkte3//qu9b6utvxvvlfefufglqfhccba8x7tvr/cafbcxh4seoeky+kivuljy3pdpnx14+sgslx8jldwkbm71ppfxx7n0q+0+/o+f7j8+iybixcaiaaxdwgbtagtulrcep3m6+2e+44r/ozy8t62ajukgklidbabl629k57cckc0tjy6ohqx62eppuro6tvqt1wobnd6cupkvp2euv679/ldt1eeunahwkorgrao4htu2twhaku0ttr7x0pl5oxnmboacnsgebe9+r03bnacgpdw8ozs7odh4sl3pohy2muzbt28/coaaggkxvvu3x6in+0peaibauzvnvbu9ndru7h6zieaqzhubrhpdvyicpgixexgkgyjjyboy81q27s0trugakj6enpgriralh1m68sf5tk7owowprqmbqmxe7y3/ezgahoqx4gokci7mkmle/nilmqqmawl4fcm78cdxqoqqbgde3j7nzv0we/bsz6t73r8wzpw5s3v37srkvkvxd2c3pkxet5ur/kq+hmkjhafgngvt3eamnlnbif7wf1czjh28uvfru3btwrzs2fmogt2fl4wfhenp6qqf4nkkbwufvffee8xfxans8bwwciktvltruaht6robg3nycuztb1rulfqtviguoaghu6zmge6s/tn0vzzbw2/p3i3kaaaaaelftksuqmcc', 'include_entities' => 'false', 'skip_status' => 'false' ); $twitter = new twitterapiexchange($settings); echo $twitter->buildoauth($url, $requestmethod) ->setpostfields($postfields) ->performrequest();
just post raw base-64 encoded image; no headers. twitter handles on end. ivborw0kggoaaaansuheugaaadaaaaawcaiaaadyyg7qaaa...
an easy way of doing base64_encode(file_get_contents("./images/tw_image.png")))
Comments
Post a Comment