- From: Melvin Carvalho <melvincarvalho@gmail.com>
- Date: Tue, 10 Jul 2012 11:53:48 +0200
- To: Andrei Sambra <andrei@fcns.eu>
- Cc: public-rww@w3.org
- Message-ID: <CAKaEYhL_aq_Kd1Rtg7uvO0u2-SeT4zGe-8MWmf67BcDZnnMfCw@mail.gmail.com>
On 7 July 2012 16:43, Andrei Sambra <andrei@fcns.eu> wrote: > Hi Melvin, > > > On 07/07/12 14:44, Melvin Carvalho wrote: > >> Has anyone been able to make a wall post from the command line? I tried >> the following unsuccessfully : >> >> echo "user=local&new=1&comment=**curltest" | curl -X POST -E >> e.pemhttps://my-profile.eu/**wall.php <http://my-profile.eu/wall.php> >> >> Any ideas? >> >> I don't think you'll be able to do that, since posting on the wall > requires the user to be authenticated through a session. Therefore, your > script would first have to authenticate (same link as the WebID button) and > save the session cookie, and only then post the message. > I've slightly modified the python script you gave me to get this to work: #!/usr/bin/env python import urllib import httplib2 cert_file = 'e.pem' http = httplib2.Http(disable_ssl_certificate_validation=True) http.add_certificate('', cert_file, domain='') url = ' https://auth.my-profile.eu/auth/index.php?authreqissuer=https://my-profile.eu/index.php ' response, content = http.request(url) headers = {'Cookie': response['set-cookie'], 'Content-type': 'application/x-www-form-urlencoded'} newurl = 'https://my-profile.eu/wall.php' body = { 'comment' : 'curltest', 'user' : 'local', 'new' : '1' } response, content = http.request(newurl, 'POST', headers=headers, body=urllib.urlencode(body)) https://gist.github.com/3082339 > > Andrei > > >
Received on Tuesday, 10 July 2012 09:54:15 UTC