downloading an attachment via Yahoo! Mail API

Obiora4 Jan 2011 5:06 PM
Hello, I am having issues with downloading an attachment via the API for Yahoo! Mail.

I have used several different Oauth libraries and have recently tested code (http://nullinfo.wordpress.com/oauth-yahoo/) for CallContact, which does work.

I am using the data generated from CallContact to download an attachment and the sent header and response are below:

GET /ya/download?mid=1_14882_AMvJjkQAAJJjTQgZpgDJg1E%252FJsk&fid=Inbox&pid=2&clean=0&inline=0 HTTP/1.1
Host: mail.yahooapis.com
Accept: */*
Authorization: OAuth realm="yahooapis.com",oauth_version="1.0",oauth_nonce="1890108292",oauth_timestamp="1294189375",oauth_consumer_key="...",oauth_token="A%3D7haljcPKlDiLigYC7eZ6af8lD_yXf_lh2fxl.SnsPPmh.N4FR8LKOWrEjC7h1qC4KOhwBfP8Ynz190
ecUDM5f6rsYUSsn1iUUresRql6Uqlbn2x3BZHZkbCJWPuBNxT9vYYHKUWdKJs_nGeG.AwXFs9YmB2sPuF
9Lrqf1Jq0qdKZysw6EY2SteTrJGVG3eCT95qe2JU6YhQAOzuh_.3A3uFivT3srxeeqpDnjtTATlG3cHyX
.dhcGoVv45qe6TJHsHWvehW7nmjmmi0LpKrZpDJz_4JneNrU0QynQnmIwXmsTcaAWAgs_sKQrsh0121mg
T8gDpjKfkeqX6ER.KdxmFzzajphBvpLUmaIKXj4HEoiDIIKMElPTXJKZ5J9ZHlWTDqykkqCUoQvbTVv67
J1FEq_nshkJLcRakdy2njPxVYP.KhXBlok7CU.0JHbGVIhPfffNbUkSGWHVXhf1oXGdn9PrSHZ05EglRe
QX.YbWACc6yR4D0BtROlqgJWNkhuE1hpg_TfHiDZNxJ7Qch2A6geMwn8x_E3kZgn75PkHqEFbgGJpd9_5
pkL1ry4ag5nyNfCyqQGDvVfNOk3511aelS82hH5NG.qVRT8KtlOHNKm3IR3lmeoeqSJXBbhbFLl49Dj2f
QyIMmn3peT340aWOPhdFWd1yhyEHa95_zMB2Qq0KJFdKp9sxVShRr_0YDQxhDdKHx8sBU21hgzkXHHmTk
ji9AfSlZh1giYYz2BBBr3vWMVpZY0RJp4X67JApXBju1IeB.u8Xvbd.q7.aR8-",oauth_signature_method="HMAC-SHA1",oauth_signature="lO%2FnmSh7frpRHi%2BV8S5EmieH2Tc%3D"

Response headers:

HTTP/1.1 404 Not Found
Date: Wed, 05 Jan 2011 01:02:40 GMT
P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1
Age: 0
Transfer-Encoding: chunked
Connection: keep-alive
Server: YTS/1.17.23

The mid has been encoded and the URL is correct and is based on the documentation. Is there something that I am missing that the documentation does not cover??

Thank you.


Sincerely,
Obiora
Asi Shmaiser23 Sep 2011 2:10 AM
Hi Obiora,<br>did u manage to solve the download problem?<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Obiora @ 4 Jan 2011 5:06 PM)</cite><blockquote class="quotemain">Hello, I am having issues with downloading an attachment via the API for Yahoo! Mail.<br><br>I have used several different Oauth libraries and have recently tested code (http://nullinfo.wordpress.com/oauth-yahoo/) for CallContact, which does work.<br><br>I am using the data generated from CallContact to download an attachment and the sent header and response are below:<br><br>GET /ya/download?mid=1_14882_AMvJjkQAAJJjTQgZpgDJg1E%252FJsk&fid=Inbox&pid=2&clean=0&inline=0 HTTP/1.1<br>Host: mail.yahooapis.com<br>Accept: */*<br>Authorization: OAuth realm=&quot;yahooapis.com&quot;,oauth_version=&quot;1.0&quot;,oauth_nonce=&quot;1890108292&quot;,oauth_timestamp=&quot;1294189375&quot;,oauth_consumer_key=&quot;...&quot;,oauth_token=&quot;A%3D7haljcPKlDiLigYC7eZ6af8lD_yXf_lh2fxl.SnsPPmh.N4FR8LKOWrEjC7h1qC4KOhwBfP8Ynz190<br>ecUDM5f6rsYUSsn1iUUresRql6Uqlbn2x3BZHZkbCJWPuBNxT9vYYHKUWdKJs_nGeG.AwXFs9YmB2sPuF<br>9Lrqf1Jq0qdKZysw6EY2SteTrJGVG3eCT95qe2JU6YhQAOzuh_.3A3uFivT3srxeeqpDnjtTATlG3cHyX<br>.dhcGoVv45qe6TJHsHWvehW7nmjmmi0LpKrZpDJz_4JneNrU0QynQnmIwXmsTcaAWAgs_sKQrsh0121mg<br>T8gDpjKfkeqX6ER.KdxmFzzajphBvpLUmaIKXj4HEoiDIIKMElPTXJKZ5J9ZHlWTDqykkqCUoQvbTVv67<br>J1FEq_nshkJLcRakdy2njPxVYP.KhXBlok7CU.0JHbGVIhPfffNbUkSGWHVXhf1oXGdn9PrSHZ05EglRe<br>QX.YbWACc6yR4D0BtROlqgJWNkhuE1hpg_TfHiDZNxJ7Qch2A6geMwn8x_E3kZgn75PkHqEFbgGJpd9_5<br>pkL1ry4ag5nyNfCyqQGDvVfNOk3511aelS82hH5NG.qVRT8KtlOHNKm3IR3lmeoeqSJXBbhbFLl49Dj2f<br>QyIMmn3peT340aWOPhdFWd1yhyEHa95_zMB2Qq0KJFdKp9sxVShRr_0YDQxhDdKHx8sBU21hgzkXHHmTk<br>ji9AfSlZh1giYYz2BBBr3vWMVpZY0RJp4X67JApXBju1IeB.u8Xvbd.q7.aR8-&quot;,oauth_signature_method=&quot;HMAC-SHA1&quot;,oauth_signature=&quot;lO%2FnmSh7frpRHi%2BV8S5EmieH2Tc%3D&quot;<br><br>Response headers:<br><br>HTTP/1.1 404 Not Found<br>Date: Wed, 05 Jan 2011 01:02:40 GMT<br>P3P: policyref=&quot;http://info.yahoo.com/w3c/p3p.xml&quot;, CP=&quot;CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV&quot;<br>Vary: Accept-Encoding<br>Content-Type: text/html; charset=iso-8859-1<br>Age: 0<br>Transfer-Encoding: chunked<br>Connection: keep-alive<br>Server: YTS/1.17.23<br><br>The mid has been encoded and the URL is correct and is based on the documentation. Is there something that I am missing that the documentation does not cover??<br><br>Thank you.<br><br><br>Sincerely,<br>Obiora</blockquote></div></div>
Obiora23 Sep 2011 5:09 PM
Yes, I did resolve the problem.<br><br>Thank you for checking in with me.<br><br><div class="quote"><div class="quotetop">QUOTE<cite>(Asi Shmaiser @ 23 Sep 2011 2:10 AM)</cite></div><blockquote class="quotemain">Hi Obiora,<br>did u manage to solve the download problem?<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Obiora @ 4 Jan 2011 5:06 PM)</cite><blockquote class="quotemain">Hello, I am having issues with downloading an attachment via the API for Yahoo! Mail.<br><br>I have used several different Oauth libraries and have recently tested code (http://nullinfo.wordpress.com/oauth-yahoo/) for CallContact, which does work.<br><br>I am using the data generated from CallContact to download an attachment and the sent header and response are below:<br><br>GET /ya/download?mid=1_14882_AMvJjkQAAJJjTQgZpgDJg1E%252FJsk&fid=Inbox&pid=2&clean=0&inline=0 HTTP/1.1<br>Host: mail.yahooapis.com<br>Accept: */*<br>Authorization: OAuth realm=&quot;yahooapis.com&quot;,oauth_version=&quot;1.0&quot;,oauth_nonce=&quot;1890108292&quot;,oauth_timestamp=&quot;1294189375&quot;,oauth_consumer_key=&quot;...&quot;,oauth_token=&quot;A%3D7haljcPKlDiLigYC7eZ6af8lD_yXf_lh2fxl.SnsPPmh.N4FR8LKOWrEjC7h1qC4KOhwBfP8Ynz190<br>ecUDM5f6rsYUSsn1iUUresRql6Uqlbn2x3BZHZkbCJWPuBNxT9vYYHKUWdKJs_nGeG.AwXFs9YmB2sPuF<br>9Lrqf1Jq0qdKZysw6EY2SteTrJGVG3eCT95qe2JU6YhQAOzuh_.3A3uFivT3srxeeqpDnjtTATlG3cHyX<br>.dhcGoVv45qe6TJHsHWvehW7nmjmmi0LpKrZpDJz_4JneNrU0QynQnmIwXmsTcaAWAgs_sKQrsh0121mg<br>T8gDpjKfkeqX6ER.KdxmFzzajphBvpLUmaIKXj4HEoiDIIKMElPTXJKZ5J9ZHlWTDqykkqCUoQvbTVv67<br>J1FEq_nshkJLcRakdy2njPxVYP.KhXBlok7CU.0JHbGVIhPfffNbUkSGWHVXhf1oXGdn9PrSHZ05EglRe<br>QX.YbWACc6yR4D0BtROlqgJWNkhuE1hpg_TfHiDZNxJ7Qch2A6geMwn8x_E3kZgn75PkHqEFbgGJpd9_5<br>pkL1ry4ag5nyNfCyqQGDvVfNOk3511aelS82hH5NG.qVRT8KtlOHNKm3IR3lmeoeqSJXBbhbFLl49Dj2f<br>QyIMmn3peT340aWOPhdFWd1yhyEHa95_zMB2Qq0KJFdKp9sxVShRr_0YDQxhDdKHx8sBU21hgzkXHHmTk<br>ji9AfSlZh1giYYz2BBBr3vWMVpZY0RJp4X67JApXBju1IeB.u8Xvbd.q7.aR8-&quot;,oauth_signature_method=&quot;HMAC-SHA1&quot;,oauth_signature=&quot;lO%2FnmSh7frpRHi%2BV8S5EmieH2Tc%3D&quot;<br><br>Response headers:<br><br>HTTP/1.1 404 Not Found<br>Date: Wed, 05 Jan 2011 01:02:40 GMT<br>P3P: policyref=&quot;http://info.yahoo.com/w3c/p3p.xml&quot;, CP=&quot;CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV&quot;<br>Vary: Accept-Encoding<br>Content-Type: text/html; charset=iso-8859-1<br>Age: 0<br>Transfer-Encoding: chunked<br>Connection: keep-alive<br>Server: YTS/1.17.23<br><br>The mid has been encoded and the URL is correct and is based on the documentation. Is there something that I am missing that the documentation does not cover??<br><br>Thank you.<br><br><br>Sincerely,<br>Obiora</blockquote></div></div></blockquote></div>
Asi Shmaiser24 Sep 2011 9:21 AM
great to here, so maybe you can help me out :)<br>I didn&#39;t understand what&#39;s the solution -&nbsp;<br><br>1. did u use an OAuth Authorization header or sent all the oauth parameters in the url?<br>2. should the signature contains the regular params (mid, fid... ) or just the basic url + oauth parameters?<br><br>this is my request:<br><br>http://mail.yahooapis.com/ya/download?clean=0&fid=Inbox&inline=0&mid=1_22_1_4931_0_AIHTimIAAAG0Tmsv5AzWR1FOqEA&pid=2&oauth_consumer_key=..............&oauth_nonce=8016381357093189350&oauth_signature=EcZSH5%2B6ny6U%2BHWAmLgWG9RXQlk%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1316881005&oauth_token=A%3DkOSQRMrSmwPrWniqY02.4qxYoKKD61EIL19M9uDuBvRBbtxCiRVx7jJum3cV6ebWNdM0zDF7sU2ezKPa2Y6cT9ZJIlazRBkxhasb_l1n3I_DmRY48drpYDMB2g4IEPZF355iOQ7FGIJaxTCT6E1nJSlmgqbx7zmrJHOe43qiyhWWSVNOLzVWUjAWdTUYN4jJ3hodR1o.55sbHlBIdq.L.lmR5D4VS7tBbqg7mt9t9gclib3s17JNwmvX.8s7OJRQ5fZMBbxWaTKytcnl_DaNlUAljYX6yEbaxkTmOMB7fNrEFeexklpNfAlTy8.rmVAddLh8J0vI12hNYYuuPRRXzMrSgDoDV27x1AsiMDt1fJWj43Sd3NPvmmwCCXwxwCXn0ad_1h.YJPUqyJxEwxuYFK85XdrHpfeULgwth6Fukh7PaC5v9jvQOQR9p_wDIHJKuBFcmZkjlp7h1ID0Y08WbdMotaX1qMkbPmMvPhX7AV8VfasFxj3vo3.MVmc6ndWLPAXX0ep6EkNrpBZadI6tK_5a213QvRPlZcneCcdXWJWD5BpyDrMXdyVdMMC5bB6jQ0jBEN9GmxbMuvt9Xo0N8IlKLJII7jfmZZpPjC8V8HklHbpOOQaDsGU1muDdNAgPKi6qp53ZH5.TuUd7X3C_51pvPC0uopJaAs7SE9XBEVjCNeEZ9jkbJuRoUgTkoBcZTNa6PJXH7j9q5NZ4KTiL2z2Kjq_3fPrO3U0plPn7cF.T0UmqLwhtZisL1HouwQ--&oauth_version=1.0<br><br>I keep getting 404 Not Found for that request.&nbsp;<br>If I drop the mid,fid.. params I get &quot;500 unable_to_get_message_info_or_part&quot;.<br><br>other calls to the Yahoo mail web services are working just fine with the oauth mechanism... <br>any ideas?<br><br>thank a lot,<br>Asi.<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Obiora @ 23 Sep 2011 5:09 PM)</cite><blockquote class="quotemain">Yes, I did resolve the problem.<br><br>Thank you for checking in with me.<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Asi Shmaiser @ 23 Sep 2011 2:10 AM)</cite><blockquote class="quotemain">Hi Obiora,<br>did u manage to solve the download problem?<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Obiora @ 4 Jan 2011 5:06 PM)</cite><blockquote class="quotemain">Hello, I am having issues with downloading an attachment via the API for Yahoo! Mail.<br><br>I have used several different Oauth libraries and have recently tested code (http://nullinfo.wordpress.com/oauth-yahoo/) for CallContact, which does work.<br><br>I am using the data generated from CallContact to download an attachment and the sent header and response are below:<br><br>GET /ya/download?mid=1_14882_AMvJjkQAAJJjTQgZpgDJg1E%252FJsk&fid=Inbox&pid=2&clean=0&inline=0 HTTP/1.1<br>Host: mail.yahooapis.com<br>Accept: */*<br>Authorization: OAuth realm=&quot;yahooapis.com&quot;,oauth_version=&quot;1.0&quot;,oauth_nonce=&quot;1890108292&quot;,oauth_timestamp=&quot;1294189375&quot;,oauth_consumer_key=&quot;...&quot;,oauth_token=&quot;A%3D7haljcPKlDiLigYC7eZ6af8lD_yXf_lh2fxl.SnsPPmh.N4FR8LKOWrEjC7h1qC4KOhwBfP8Ynz190<br>ecUDM5f6rsYUSsn1iUUresRql6Uqlbn2x3BZHZkbCJWPuBNxT9vYYHKUWdKJs_nGeG.AwXFs9YmB2sPuF<br>9Lrqf1Jq0qdKZysw6EY2SteTrJGVG3eCT95qe2JU6YhQAOzuh_.3A3uFivT3srxeeqpDnjtTATlG3cHyX<br>.dhcGoVv45qe6TJHsHWvehW7nmjmmi0LpKrZpDJz_4JneNrU0QynQnmIwXmsTcaAWAgs_sKQrsh0121mg<br>T8gDpjKfkeqX6ER.KdxmFzzajphBvpLUmaIKXj4HEoiDIIKMElPTXJKZ5J9ZHlWTDqykkqCUoQvbTVv67<br>J1FEq_nshkJLcRakdy2njPxVYP.KhXBlok7CU.0JHbGVIhPfffNbUkSGWHVXhf1oXGdn9PrSHZ05EglRe<br>QX.YbWACc6yR4D0BtROlqgJWNkhuE1hpg_TfHiDZNxJ7Qch2A6geMwn8x_E3kZgn75PkHqEFbgGJpd9_5<br>pkL1ry4ag5nyNfCyqQGDvVfNOk3511aelS82hH5NG.qVRT8KtlOHNKm3IR3lmeoeqSJXBbhbFLl49Dj2f<br>QyIMmn3peT340aWOPhdFWd1yhyEHa95_zMB2Qq0KJFdKp9sxVShRr_0YDQxhDdKHx8sBU21hgzkXHHmTk<br>ji9AfSlZh1giYYz2BBBr3vWMVpZY0RJp4X67JApXBju1IeB.u8Xvbd.q7.aR8-&quot;,oauth_signature_method=&quot;HMAC-SHA1&quot;,oauth_signature=&quot;lO%2FnmSh7frpRHi%2BV8S5EmieH2Tc%3D&quot;<br><br>Response headers:<br><br>HTTP/1.1 404 Not Found<br>Date: Wed, 05 Jan 2011 01:02:40 GMT<br>P3P: policyref=&quot;http://info.yahoo.com/w3c/p3p.xml&quot;, CP=&quot;CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV&quot;<br>Vary: Accept-Encoding<br>Content-Type: text/html; charset=iso-8859-1<br>Age: 0<br>Transfer-Encoding: chunked<br>Connection: keep-alive<br>Server: YTS/1.17.23<br><br>The mid has been encoded and the URL is correct and is based on the documentation. Is there something that I am missing that the documentation does not cover??<br><br>Thank you.<br><br><br>Sincerely,<br>Obiora</blockquote></div></div></blockquote></div></div></blockquote></div></div>
Obiora26 Sep 2011 8:02 AM
Asi,<br><br>I did figure it out back in February of this year and have done a lot of other programming since then, so I don&#39;t recall specifically what was wrong, so I am just going to include the working program below:<br><br>&lt;?php<br><br>//Libraries used for accessing YMail api&#39;s.<br>require_once &#39;OAuth.php&#39;;<br>require_once &#39;JsonRpcClient.inc&#39;;<br><br>//Endpoint for Yahoo mail WSDL<br>$endPoint = &#39;http://mail.yahooapis.com/ws/mail/v1.1&#39;;<br><br>//OAuth Endpoint<br>$OAuthEndPoint = &#39;https://api.login.yahoo.com/oauth/v2&#39;;<br><br>//You can get these keys from YDN.<br>$OAuthConsumerKey = &#39;&#39;;<br>$OAuthConsumerSecret = &#39;&#39;;<br><br>// see http://developer.yahoo.com/oauth/guide/oauth-auth-flow.html<br>$signature = new OAuthSignatureMethod_HMAC_SHA1();<br><br>// 1) Get Request Token<br>$request = new OAuthRequest(&#39;GET&#39;, &quot;$OAuthEndPoint/get_request_token&quot;, array(<br>&nbsp;&nbsp;&nbsp; &#39;oauth_consumer_key&#39;=&gt;$OAuthConsumerKey,<br>&nbsp;&nbsp;&nbsp; &#39;oauth_signature_method&#39;=&gt;&#39;PLAINTEXT&#39;,<br>&nbsp;&nbsp;&nbsp; &#39;oauth_version&#39;=&gt;&#39;1.0&#39;,<br>&nbsp;&nbsp;&nbsp; &#39;oauth_timestamp&#39;=&gt;time(),&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &#39;oauth_nonce&#39;=&gt;mt_rand(),<br>&nbsp;&nbsp;&nbsp; &#39;oauth_callback&#39;=&gt;&#39;oob&#39;));<br>$url = $request-&gt;to_url().&quot;&oauth_signature=$OAuthConsumerSecret%26&quot;;<br><br>$ch = curl_init();<br>curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );<br>curl_setopt( $ch, CURLOPT_URL, $url );<br>$resp = curl_exec( $ch );<br>curl_close($ch);<br>parse_str($resp,$tokens);<br>$oauth_token = $tokens[&#39;oauth_token&#39;];<br>$oauth_token_secret = $tokens[&#39;oauth_token_secret&#39;];<br><br>if (!$oauth_token || !$oauth_token_secret) {<br>&nbsp;&nbsp;&nbsp; throw new Exception($resp);&nbsp;&nbsp;&nbsp; <br>}<br><br>// 2) Get User Auth<br>echo &quot; Open this Url in your browser -&gt;&gt; $OAuthEndPoint/request_auth?oauth_token=$oauth_token &#92;n&quot;;<br>echo &quot; This should be provided to end users of your application.End users should provide their <br>&#39;Username&#39; and &#39;Password&#39; and sign-in which means they authorize your app. On successful login the end users will see a code in the page &#92;n&quot;;<br>echo &quot; This code is the oauth_token which Yahoo returns to your app &#92;n&quot;;<br>echo &quot; Enter the code here: &quot;;<br>$oauth_verifier = trim(fgets(STDIN));<br><br>// 3) Get Access Token<br>$request = new OAuthRequest(&#39;GET&#39;, &quot;$OAuthEndPoint/get_token&quot;, array(<br>&nbsp;&nbsp;&nbsp; &#39;oauth_consumer_key&#39;=&gt;$OAuthConsumerKey,&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &#39;oauth_signature_method&#39;=&gt;&#39;PLAINTEXT&#39;,<br>&nbsp;&nbsp;&nbsp; &#39;oauth_version&#39;=&gt;&#39;1.0&#39;,<br>&nbsp;&nbsp;&nbsp; &#39;oauth_verifier&#39;=&gt;$oauth_verifier,<br>&nbsp;&nbsp;&nbsp; &#39;oauth_token&#39;=&gt;$oauth_token,&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &#39;oauth_timestamp&#39;=&gt;time(),&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &#39;oauth_nonce&#39;=&gt;mt_rand(),&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; ));<br>$url = $request-&gt;to_url().&quot;&oauth_signature=$OAuthConsumerSecret%26$oauth_token_secret&quot;;<br><br>$ch = curl_init();<br>curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );<br>curl_setopt( $ch, CURLOPT_URL, $url );<br>$resp = curl_exec( $ch );<br>curl_close($ch);<br><br>parse_str($resp);<br>if (!$oauth_token || !$oauth_token_secret) {<br>&nbsp;&nbsp;&nbsp; throw new Exception($resp);&nbsp;&nbsp;&nbsp; <br>}<br><br>$mid = &#39;&#39;; //i.e., 1_68195_AMvJjkQAAJJjTQgZpgDJg1E%2FJsk<br><br>$request = new OAuthRequest(&#39;GET&#39;, &quot;http://mail.yahooapis.com/ya/download/?mid=$mid&fid=Inbox&pid=2&clean=0&inline=0&quot;, array(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;oauth_consumer_key&#39;=&gt;$OAuthConsumerKey,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;oauth_nonce&#39;=&gt;mt_rand(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;oauth_signature_method&#39;=&gt;&#39;HMAC-SHA1&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;oauth_timestamp&#39;=&gt;time(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;oauth_token&#39;=&gt;$oauth_token,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;oauth_version&#39;=&gt;&#39;1.0&#39;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;oauth_callback&#39;=&gt;&#39;oob&#39;));<br>$request-&gt;sign_request($signature, new OAuthConsumer(&#39;&#39;, $OAuthConsumerSecret), new OAuthToken(&#39;&#39;, $oauth_token_secret));<br>$oauthURL = $request-&gt;to_url();<br><br>$ch = curl_init(); <br>curl_setopt($ch, CURLOPT_URL, $oauthURL);<br>curl_setopt($ch, CURLOPT_HEADER, true);<br>curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<br>$header = curl_exec($ch);<br>if ( curl_errno($ch)) {<br>&nbsp;&nbsp;&nbsp; $code = 0;<br>}<br>else {<br>$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);<br>}<br><br>echo &quot;&#92;n&#92;n&quot;.$header; //header contains the attachment--simple way of getting attachment<br><br>$file = &#39;&#39;; //i.e., file.pdf<br>$fh = fopen($file, &#39;w&#39;) or die(&quot;can&#39;t open file&quot;);<br>fwrite($fh, $header);<br>fclose($fh);<br><br>curl_close($ch);<br><br>exit(0);<br><br><br><br><div class="quote"><div class="quotetop">QUOTE<cite>(Asi Shmaiser @ 24 Sep 2011 9:21 AM)</cite></div><blockquote class="quotemain">great to here, so maybe you can help me out :)<br>I didn&#39;t understand what&#39;s the solution -&nbsp;<br><br>1. did u use an OAuth Authorization header or sent all the oauth parameters in the url?<br>2. should the signature contains the regular params (mid, fid... ) or just the basic url + oauth parameters?<br><br>this is my request:<br><br>http://mail.yahooapis.com/ya/download?clean=0&fid=Inbox&inline=0&mid=1_22_1_4931_0_AIHTimIAAAG0Tmsv5AzWR1FOqEA&pid=2&oauth_consumer_key=..............&oauth_nonce=8016381357093189350&oauth_signature=EcZSH5%2B6ny6U%2BHWAmLgWG9RXQlk%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1316881005&oauth_token=A%3DkOSQRMrSmwPrWniqY02.4qxYoKKD61EIL19M9uDuBvRBbtxCiRVx7jJum3cV6ebWNdM0zDF7sU2ezKPa2Y6cT9ZJIlazRBkxhasb_l1n3I_DmRY48drpYDMB2g4IEPZF355iOQ7FGIJaxTCT6E1nJSlmgqbx7zmrJHOe43qiyhWWSVNOLzVWUjAWdTUYN4jJ3hodR1o.55sbHlBIdq.L.lmR5D4VS7tBbqg7mt9t9gclib3s17JNwmvX.8s7OJRQ5fZMBbxWaTKytcnl_DaNlUAljYX6yEbaxkTmOMB7fNrEFeexklpNfAlTy8.rmVAddLh8J0vI12hNYYuuPRRXzMrSgDoDV27x1AsiMDt1fJWj43Sd3NPvmmwCCXwxwCXn0ad_1h.YJPUqyJxEwxuYFK85XdrHpfeULgwth6Fukh7PaC5v9jvQOQR9p_wDIHJKuBFcmZkjlp7h1ID0Y08WbdMotaX1qMkbPmMvPhX7AV8VfasFxj3vo3.MVmc6ndWLPAXX0ep6EkNrpBZadI6tK_5a213QvRPlZcneCcdXWJWD5BpyDrMXdyVdMMC5bB6jQ0jBEN9GmxbMuvt9Xo0N8IlKLJII7jfmZZpPjC8V8HklHbpOOQaDsGU1muDdNAgPKi6qp53ZH5.TuUd7X3C_51pvPC0uopJaAs7SE9XBEVjCNeEZ9jkbJuRoUgTkoBcZTNa6PJXH7j9q5NZ4KTiL2z2Kjq_3fPrO3U0plPn7cF.T0UmqLwhtZisL1HouwQ--&oauth_version=1.0<br><br>I keep getting 404 Not Found for that request.&nbsp;<br>If I drop the mid,fid.. params I get &quot;500 unable_to_get_message_info_or_part&quot;.<br><br>other calls to the Yahoo mail web services are working just fine with the oauth mechanism... <br>any ideas?<br><br>thank a lot,<br>Asi.<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Obiora @ 23 Sep 2011 5:09 PM)</cite><blockquote class="quotemain">Yes, I did resolve the problem.<br><br>Thank you for checking in with me.<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Asi Shmaiser @ 23 Sep 2011 2:10 AM)</cite><blockquote class="quotemain">Hi Obiora,<br>did u manage to solve the download problem?<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Obiora @ 4 Jan 2011 5:06 PM)</cite><blockquote class="quotemain">Hello, I am having issues with downloading an attachment via the API for Yahoo! Mail.<br><br>I have used several different Oauth libraries and have recently tested code (http://nullinfo.wordpress.com/oauth-yahoo/) for CallContact, which does work.<br><br>I am using the data generated from CallContact to download an attachment and the sent header and response are below:<br><br>GET /ya/download?mid=1_14882_AMvJjkQAAJJjTQgZpgDJg1E%252FJsk&fid=Inbox&pid=2&clean=0&inline=0 HTTP/1.1<br>Host: mail.yahooapis.com<br>Accept: */*<br>Authorization: OAuth realm=&quot;yahooapis.com&quot;,oauth_version=&quot;1.0&quot;,oauth_nonce=&quot;1890108292&quot;,oauth_timestamp=&quot;1294189375&quot;,oauth_consumer_key=&quot;...&quot;,oauth_token=&quot;A%3D7haljcPKlDiLigYC7eZ6af8lD_yXf_lh2fxl.SnsPPmh.N4FR8LKOWrEjC7h1qC4KOhwBfP8Ynz190<br>ecUDM5f6rsYUSsn1iUUresRql6Uqlbn2x3BZHZkbCJWPuBNxT9vYYHKUWdKJs_nGeG.AwXFs9YmB2sPuF<br>9Lrqf1Jq0qdKZysw6EY2SteTrJGVG3eCT95qe2JU6YhQAOzuh_.3A3uFivT3srxeeqpDnjtTATlG3cHyX<br>.dhcGoVv45qe6TJHsHWvehW7nmjmmi0LpKrZpDJz_4JneNrU0QynQnmIwXmsTcaAWAgs_sKQrsh0121mg<br>T8gDpjKfkeqX6ER.KdxmFzzajphBvpLUmaIKXj4HEoiDIIKMElPTXJKZ5J9ZHlWTDqykkqCUoQvbTVv67<br>J1FEq_nshkJLcRakdy2njPxVYP.KhXBlok7CU.0JHbGVIhPfffNbUkSGWHVXhf1oXGdn9PrSHZ05EglRe<br>QX.YbWACc6yR4D0BtROlqgJWNkhuE1hpg_TfHiDZNxJ7Qch2A6geMwn8x_E3kZgn75PkHqEFbgGJpd9_5<br>pkL1ry4ag5nyNfCyqQGDvVfNOk3511aelS82hH5NG.qVRT8KtlOHNKm3IR3lmeoeqSJXBbhbFLl49Dj2f<br>QyIMmn3peT340aWOPhdFWd1yhyEHa95_zMB2Qq0KJFdKp9sxVShRr_0YDQxhDdKHx8sBU21hgzkXHHmTk<br>ji9AfSlZh1giYYz2BBBr3vWMVpZY0RJp4X67JApXBju1IeB.u8Xvbd.q7.aR8-&quot;,oauth_signature_method=&quot;HMAC-SHA1&quot;,oauth_signature=&quot;lO%2FnmSh7frpRHi%2BV8S5EmieH2Tc%3D&quot;<br><br>Response headers:<br><br>HTTP/1.1 404 Not Found<br>Date: Wed, 05 Jan 2011 01:02:40 GMT<br>P3P: policyref=&quot;http://info.yahoo.com/w3c/p3p.xml&quot;, CP=&quot;CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV&quot;<br>Vary: Accept-Encoding<br>Content-Type: text/html; charset=iso-8859-1<br>Age: 0<br>Transfer-Encoding: chunked<br>Connection: keep-alive<br>Server: YTS/1.17.23<br><br>The mid has been encoded and the URL is correct and is based on the documentation. Is there something that I am missing that the documentation does not cover??<br><br>Thank you.<br><br><br>Sincerely,<br>Obiora</blockquote></div></div></blockquote></div></div></blockquote></div></div></blockquote></div>