I need your expert help with this question
since http requests can be made on webpages, apps, etc with...
- iframes (good example: facebook widgets)
- server side requests to remote servers (with: java, python, php)
- image embeds, video embeds (html)
- api requests (same as ss request)
- ajax requests (on same host)
- and more
1.) What is the main difference between these types of requests?
2.) Do they all use the same amount of (bandwidth etc..), for example if I use file_get_contents("http://somesite/somefile.htm")
(php) versus
the html version <iframe src="http://somesite/somefile.htm">
, am I requesting the same thing or is there more 'weight' on one versus the other..
3.) What causes the differences, if that's the case?
Regards,
Avon
The simple answer to your question of calling a filename using file_get_contents and iframe, the content returned is identical. However, the rest of your questions really depends on what the different implementations do. Usually you will find that
- server-side requests as are just the same as HTML for bandwidth, as the output is just pure HTML
- iframes are usually lighter weight, as they do not usually have the template (i.e. the stuff outside the frame) included in the HTML.
- image / video embeds is just a piece of HTML, but if the images or video are stored on your server, this data is usually a lot bigger than the HTML itself (videos especially)
- API requests are usually very small, as they return a very small amount of data to specifically respond to the request. However, if you are requested a LOT of data, then this does have the potential to be large.
- AJAX is similar to API in terms of bandwidth. Has the potential to be very low, as it only returns the data that is needed, but if there is a LOT of data, this can be quite large.
AJAX and API calls are usually the smallest however.