I am looking to code scripts, but I would like to know how would I let's say get data from one website (site1.com - let's say the page contains ONLY text, IE: abc123) and I want another website to be able to grab this data (site2.com) in a PHP format, no iframes or anything, if possible.
How would I go about doing such? I want to code API like scripts, so people can add them to their site and what not, for example; string generator (site1.com will generate the string, and site2.com will be able to use the string in a php format)
And the way I would like to learn is the same as above, AND also a way where site2.com can choose the length of the returned value. Like site1.com will be setup obviously to return let's say if site2 wanted a string of 5 digits, site1 will generate the string and simply return it in the page (site1.com/gen?leng=5 could work, but its the matter of getting it displayed on the site..)
I want site1 to generate a string, per say. And I want an external site (site2) to be able to obtain this string and use it in PHP format, like $string = site1generatedstring