<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developer.myspace.com/Community/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>JavaScript/HTML - Container</title><link>http://developer.myspace.com/Community/forums/23.aspx</link><description>Discuss the OpenSocial container interface for MySpace.</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20910.1126)</generator><item><title>Re: Please provide PHP code that validates oauth_signature</title><link>http://developer.myspace.com/Community/forums/thread/23668.aspx</link><pubDate>Thu, 09 Oct 2008 22:53:27 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:23668</guid><dc:creator>Ligys Studios</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/23668.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=23668</wfw:commentRss><description>&lt;p&gt;I know this thread is a big old...&lt;/p&gt;&lt;p&gt;&amp;nbsp;But, I had a thought on&amp;nbsp; your question about how Zynga does it, doesnt Zynga track the friend&amp;#39;s ID on the invite, if so why couldnt they just check to see if that user had been referred or not from a variable in the database after they click invite? &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Please provide PHP code that validates oauth_signature</title><link>http://developer.myspace.com/Community/forums/thread/7353.aspx</link><pubDate>Thu, 10 Apr 2008 18:53:02 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7353</guid><dc:creator>AppAuthor</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7353.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7353</wfw:commentRss><description>&lt;p&gt;Jeremy,&lt;/p&gt;
&lt;p&gt;As always, your code worked perfectly.&lt;/p&gt;
&lt;p&gt;Regarding your question as to apps that&amp;nbsp;appear to use this mechanism to credit users for referrals:&lt;/p&gt;
&lt;p&gt;Check out any of the Zynga apps, including Ace Texas Hold&amp;#39;em Poker. When a user refers new members, the user receives&amp;nbsp;additional &amp;quot;points&amp;quot; to play with. This is done via a link to their server which includes a &amp;quot;sid&amp;quot; parameter. That link redirects to the MySpace installation page for their app, WITHOUT the &amp;quot;sid&amp;quot; parameter. So the big question is: How does Zynga know that the new member was referred by a particular user? It would seem they would have to credit the user for a referral, even if the new member does not complete the installation process. What do you think?&lt;/p&gt;</description></item><item><title>Re: Please provide PHP code that validates oauth_signature</title><link>http://developer.myspace.com/Community/forums/thread/7336.aspx</link><pubDate>Thu, 10 Apr 2008 17:26:25 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7336</guid><dc:creator>Jeremy</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7336.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7336</wfw:commentRss><description>&lt;p&gt;This chunk of PHP (originally posted by CrushSpot) verifies callback urls for me:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $remote_signature = $_GET[&amp;#39;oauth_signature&amp;#39;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $url = strtolower(&amp;#39;http://myserver.net/uri_to_this_script.php&amp;#39;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unset($_GET[&amp;#39;oauth_signature&amp;#39;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ksort($_GET);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $base_string = &amp;#39;GET&amp;amp;&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlencode($url).&amp;#39;&amp;amp;&amp;#39;.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlencode(http_build_query($_GET));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $secret = &amp;#39;security_key&amp;#39;.&amp;#39;&amp;amp;&amp;#39;;&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $local_signature = base64_encode(hash_hmac(&amp;quot;sha1&amp;quot;, $base_string, $secret, TRUE));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($remote_signature == $local_signature) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $fh = fopen(&amp;quot;cb_output.txt&amp;quot;, &amp;#39;w&amp;#39;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fwrite($fh, &amp;quot;Authenticationed!\n&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fclose($fh);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $fh = fopen(&amp;quot;cb_output.txt&amp;quot;, &amp;#39;w&amp;#39;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fwrite($fh, &amp;quot;Authentication FAILED!\n&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fwrite($fh, &amp;quot;Remote Sig: &amp;quot;.$remote_signature.&amp;quot;\n&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fwrite($fh, &amp;quot;Local Sig: &amp;quot;.$local_signature.&amp;quot;\n&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fclose($fh);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;?&amp;gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What it does is&amp;nbsp;write to a file, &amp;#39;cb_output.txt&amp;#39;, whether or not&amp;nbsp;the ping authenticated. Obviously, that&amp;#39;s not going to work long term, but it does for a simple test.&lt;/p&gt;
&lt;p&gt;Two notes: &lt;br /&gt;$url needs to be set to the URL of the file, and needs to match what you set the Callback URL to precisely.&lt;/p&gt;
&lt;p&gt;$secret needs to be set to&amp;nbsp;the Security Key of the calling App, and it needs an &amp;#39;&amp;amp;&amp;#39; appended to the end.&lt;/p&gt;
&lt;p&gt;Now, as far as this:&lt;/p&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;It appears that apps are using this mechanism to credit users for referrals. They attach a &amp;quot;userid_to_credit&amp;quot; parameter to the end of their install URL. I assume that the &amp;quot;userid_to_credit&amp;quot; is passed to the Install Callback URL.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve never seen this work. If you have a link to the App that does this, cool, &amp;#39;cause I&amp;#39;d like to see what they&amp;#39;re doing. This sort of functionality has been requested by a fair number of users in the Suggestions forums, and that tells me its not implemented. Maybe the App designers are hoping and planning ahead, &amp;#39;cause no parameters from the referring Profile URL get passed along to the Callback URL that I&amp;#39;ve seen.&lt;/p&gt;</description></item><item><title>Re: Please provide PHP code that validates oauth_signature</title><link>http://developer.myspace.com/Community/forums/thread/7308.aspx</link><pubDate>Thu, 10 Apr 2008 15:20:25 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7308</guid><dc:creator>AppAuthor</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7308.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7308</wfw:commentRss><description>&lt;p&gt;Chris,&lt;/p&gt;
&lt;p&gt;Your reply did not answer my question.&lt;/p&gt;
&lt;p&gt;With all due respect, please only reply to this post if you can provide a tested example that actually works. Otherwise, the MDP team thinks that&amp;nbsp;this issue has been resolved, which it has not.&lt;/p&gt;
&lt;p&gt;This issue is still open.&lt;/p&gt;</description></item><item><title>Re: Please provide PHP code that validates oauth_signature</title><link>http://developer.myspace.com/Community/forums/thread/7306.aspx</link><pubDate>Thu, 10 Apr 2008 15:13:21 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7306</guid><dc:creator>Chris</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7306.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7306</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;If the code I posted doesn&amp;#39;t work then I suspect it&amp;#39;s linked to one or more of the variables being passed into the script at install-time. I know that for a regular makeRequest call you have to strip out the &amp;quot;opensocial_signature&amp;quot; parameter to make the signature validate so perhaps there are more parameters that need to be stripped out. I would suggest getting a list of all the variables that are being passed into the php script (var_dump etc...) and then try different combinations of variables until something works.&lt;/p&gt;&lt;p&gt;&amp;nbsp;As for documentation about all of this, pretty much everything I&amp;#39;ve learned so far about makeRequest has been either through trial &amp;amp; error, or from forum threads. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Please provide PHP code that validates oauth_signature</title><link>http://developer.myspace.com/Community/forums/thread/7304.aspx</link><pubDate>Thu, 10 Apr 2008 14:49:43 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7304</guid><dc:creator>AppAuthor</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7304.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7304</wfw:commentRss><description>&lt;p&gt;Chris, thank you for your reply, but unfortunately your code did not work.&lt;/p&gt;
&lt;p&gt;I am trying to use the Install Callback URL. When my App is installed, my PHP script is called, but none of the code posted on these forums will correctly validate the oauth_signature with the OAuth Consumer Secret.&lt;/p&gt;
&lt;p&gt;It appears that apps are using this mechanism to credit users for referrals. They attach a &amp;quot;userid_to_credit&amp;quot; parameter to the end of their install URL. I assume that the &amp;quot;userid_to_credit&amp;quot; is passed to the Install Callback URL.&lt;/p&gt;
&lt;p&gt;Is there any documentation which describes how to accomplish this (with an example), or is this a well-kept secret?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Please provide PHP code that validates oauth_signature</title><link>http://developer.myspace.com/Community/forums/thread/7291.aspx</link><pubDate>Thu, 10 Apr 2008 09:45:17 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7291</guid><dc:creator>Chris</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7291.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7291</wfw:commentRss><description>&lt;p&gt;If I&amp;#39;d read this post a week ago I&amp;#39;d have agreed with you, but I&amp;#39;ve managed to get OAuth working successfully with my own code which is loosely based upon some of the code snippets I&amp;#39;ve found on the forums here (the main modifications I&amp;#39;ve made are either to make the code more readable or to help fit it into the framework I&amp;#39;m building). &lt;br /&gt;&lt;/p&gt;&lt;p&gt;I have found that you need to worry more about making sure the variables (if any) that you send over with a makeRequest() call are encoded in the same way as OAuth treats them. For example my validation code works, but currently it fails if you send over a string variable that has any non alphanumeric characters (e.g. space, !&amp;quot;£$% ...).&amp;nbsp; I&amp;#39;ve got a way to fix that but the point is that the error is in my code elsewhere, not in the OAuth validation function. &lt;/p&gt;&lt;p&gt;I&amp;#39;ve posted my own working code below but I&amp;#39;m still working on that at the moment to remove the problem I noted above with non-alphanumeric characters and I still have to test it when using GET requests (in theory it *should* work but i&amp;#39;ve not tested that yet). It works in most cases, but I wouldn&amp;#39;t say it&amp;#39;s ready for use in the real world so I wouldn&amp;#39;t suggest using it for anything you need to put live quickly. Look at it more like something to play about with and base your own code on. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Chris&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;ps. for reference my code is based on the code posted by Nick &amp;amp; TK in this thread: http://developer.myspace.com/Community/forums/t/1087.aspx&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;############&lt;/p&gt;&lt;p&gt;&amp;nbsp;function checkSig($targetURL, $consumerKey, $secretKey, $mode = &amp;quot;POST&amp;quot;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(preg_match(&amp;#39;/\?=&amp;amp;/&amp;#39;, $_SERVER[&amp;#39;REQUEST_URI&amp;#39;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $_GET[&amp;#39;&amp;#39;] = &amp;#39;&amp;#39;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(isset($_GET[&amp;#39;oauth_signature&amp;#39;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$checkSig = $_GET[&amp;#39;oauth_signature&amp;#39;];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;unset($_GET[&amp;#39;oauth_signature&amp;#39;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;foreach($_GET as $key =&amp;gt; $value) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$_POST[$key] = $value;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(strcmp($mode, &amp;quot;POST&amp;quot;) == 0) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$vars = $_POST;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$vars = $_GET;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ksort($vars);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$getString = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$firstVar = TRUE;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$vars[&amp;quot;oauth_consumer_key&amp;quot;]= urlencode($vars[&amp;quot;oauth_consumer_key&amp;quot;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;foreach($vars as $key =&amp;gt; $value) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if($firstVar == TRUE) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$firstVar = FALSE;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$getString .= urlencode($key) . urlencode(&amp;quot;=&amp;quot;) . urlencode($value);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$getString .= urlencode(&amp;quot;&amp;amp;&amp;quot;) . urlencode($key) . urlencode(&amp;quot;=&amp;quot;) . urlencode($value);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$text = $mode . &amp;#39;&amp;amp;&amp;#39; . urlencode($targetURL) . &amp;#39;&amp;amp;&amp;#39; . $getString;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$key = $secretKey . &amp;quot;&amp;amp;&amp;quot; . &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$sig = base64_encode(hash_hmac(&amp;quot;sha1&amp;quot;, $text, $key, TRUE));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(strcmp($sig, $checkSig) == 0) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return TRUE;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return FALSE;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;}&lt;/p&gt;</description></item><item><title>Please provide PHP code that validates oauth_signature</title><link>http://developer.myspace.com/Community/forums/thread/7268.aspx</link><pubDate>Thu, 10 Apr 2008 03:28:48 GMT</pubDate><guid isPermaLink="false">8e485011-333f-425c-b84a-1febdb8bfab0:7268</guid><dc:creator>AppAuthor</dc:creator><slash:comments>0</slash:comments><comments>http://developer.myspace.com/Community/forums/thread/7268.aspx</comments><wfw:commentRss>http://developer.myspace.com/Community/forums/commentrss.aspx?SectionID=23&amp;PostID=7268</wfw:commentRss><description>&lt;p&gt;Please provide PHP code that validates oauth_signature with the OAuth Consumer Secret. If a library needs to be included, then please provide the URL where the library can be downloaded, and please indicate any manual changes that must be made to the library for it to work with the MDP’s current configuration.&lt;/p&gt;
&lt;p&gt;Please only provide code that has been recently tested. I have tried every code sample in these forums that relate to this issue, and none of them work.&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>