"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
1.) Please think a tiny bit before posting: Since you need PUT, you will not use the _POST, but the _PUT option.
2.) How authentication is done depends on the REST-API you are trying to use.. Loads of sites use oAuth, just use google to find some tutorials on how to do the authorization.
It's not oAuth or anything, I just need to pass a parameter called "Authorization" and use my token.
I used to have:
file_get_contents("http://api.thesitewiththeapi.com?action=contentload&Authorization=4829234&type=8&path=http://myfile");
And it worked fine and it took me 5 minutes to code. But they changed the API and it doesn't work anymore and I apparently have to use cURL now. I've already spent more than all day studying cURL documentation and getting nowhere. I just need to convert the above line to cURL. Insead of url paramaters I apparently have to use XML or JSON.
This looks like a pretty good summary of the cURL part: http://www.gen-x-design.com/archives...quests-in-php/ . Basically, for the PUT method, it creates a file handle in memory where you would (temporarily) store your data (XML, JSON, whatever), then access via the curl_setopt() functions as demonstrated in the PUT example there.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks