PHP Classes

oauth and discogs

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement PHP ...  >  All threads  >  oauth and discogs  >  (Un) Subscribe thread alerts  
Subject:oauth and discogs
Summary:cannot send post requests
Messages:2
Author:Thomas Herzog
Date:2014-11-23 12:33:28
 

  1. oauth and discogs   Reply   Report abuse  
Picture of Thomas Herzog Thomas Herzog - 2014-11-23 12:33:28
after trying to cope with aouth on my own (To be honest I am not really
a developer in php, I am more working on webDesign, having little
programming skills) I found your oauth class in the web. Actually I am
working on a project for a friend of mine running a vinyl record store.
So my intention ist to build up a database for him cause he is a user of
discogs. I got the aouth thing running (but it took a while :-)).
Now I am facing problems to send a post request to discogs. I don't know
if my understanding of your class is o.k.
Attached find the description of what I want to do with discogs. All
"GETS" work but whenever I want to change something that needs a post
request, nothing changes in the discogs database, although aouth is
working ???
I tried to send a "edit profile" request, which documentation is here:
discogs.com/developers/#page:user-identity,header:user-identity-profile-post

The extract piece of code in dependence of your class is:
-------

if(($success = $client->Initialize()))
{

if(($success = $client->Process()))
{

if(strlen($client->access_token))
{

$success = $client->CallAPI(
'http://api.discogs.com/users/tomsMusicCollection',
'POST', array( "location"=>"Duesseldorf")
, array('FailOnAccessError'=>true), $result);
}
}

$success = $client->Finalize($success);

}

if($client->exit)
exit;
if($success)
{

echo '<pre>', HtmlSpecialChars(print_r($result, 1)), '</pre>';
}
?>
-------
The result I get is:

stdClass Object
(
[profile] =>
[wantlist_url] =>
api.discogs.com/users/tomsMusicColl ...
[rank] => 0
[num_pending] => 0
[id] => 2520489
[num_for_sale] => 0
[home_page] =>
[location] => Lahr
[collection_folders_url] =>
api.discogs.com/users/tomsMusicColl ...
[email] => thomas.herzog@herzog-web.de
[username] => tomsMusicCollection
[collection_fields_url] =>
api.discogs.com/users/tomsMusicColl ...
[releases_contributed] => 0
[registered] => 2014-11-14T06:23:42
[rating_avg] => 0
[num_collection] => 1
[releases_rated] => 0
[num_lists] => 0
[name] =>
[num_wantlist] => 0
[inventory_url] =>
api.discogs.com/users/tomsMusicColl ...
[uri] => http://www.discogs.com/user/tomsMusicCollection
[avatar_url] =>
gravatar.com/avatar/e69cfeec8415183 ...

[resource_url] => http://api.discogs.com/users/tomsMusicCollection
)
so "location" did not change ?????


Is my understanding of your class wrong, that I can request gets, posts
and deletes or do u have an idea of what I am doing wrong.

Thx a lot in advance.


Tom

  2. Re: oauth and discogs   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-11-24 00:30:31 - In reply to message 1 from Thomas Herzog
I tried it here and it does not update the profile either.

I figured that you need to set the user agent in the oauth_user_agent variable to something unique for the requests to be accepted, but that is not the problem.

Have you tried doing with their recommended PHP library?