rashgang Posted September 16, 2013 Share Posted September 16, 2013 Hi All, Please anyone help me to write api for a portal sites. I am new to api services. Please anyone tell me how to use REST. Also i would like to know what is the difference between rest and soap. Why should not use soap ?. Please show me some examples to write api for a site. is it safe to write api in rest ? Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted September 16, 2013 Solution Share Posted September 16, 2013 - Use a few other APIs to learn how other people do them. - Google "REST API" and read the results. - REST is purely HTTP headers, SOAP is regular HTTP with lots (lots) of XML, but sometimes it's easier to code for than REST (like in other languages besides PHP). - Showing examples of APIs is crazy. There's too much to post. Like I said: Google it. - Yes, a REST API is totally safe. I don't know why you would think it isn't. Quote Link to comment Share on other sites More sharing options...
priyankagound Posted September 18, 2013 Share Posted September 18, 2013 Some Facebook widgets do use iframes. Twitter uses javascript that most likely interacts with Ajax scripts on their server and returns HTML code to output to an HTML element that is part of their widget embed code. Either way works. Example based on Javascript and PHP (no Ajax): Embed Code <script type="text/javascript">width = 527;height = 95;</script><script type="text/javascript" src="http://www.mysite.com/widget.js"></script> widget.js document.write('<iframe scrolling="no" frameborder="0" width="' + width + '" height="' + height + '" src="http://www.mysite.com/showdata.php?height=' + height + '&width=' + width + '" style="border: 1px solid #6c82b5;"></iframe>'); And showdata.php could be any PHP script you want to display any data you want. You can give your users some flexibility about design and colors by passing variables through the javascript as you see me doing here. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.