MySpace Developer Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

PHP Client Library

Last post 08-19-2008 10:40 AM by Frik. 121 replies.
Page 1 of 9 (122 items) 1 2 3 4 5 Next > ... Last »
Sort Posts: Previous Next
  • 02-06-2008 2:31 PM

    • Jerome
    • Top 500 Contributor
    • Joined on 02-05-2008
    • Posts 7

    PHP Client Library

    This is a quick implementation of a PHP library for the REST API.

    It's using curl but falls back onto file_get_contents, a fsockopen could be done but I prefer curl so I did not bother. I've looked at most calls but not all of them so it might fail on some of them (specific photo/album/video details)

    It throws an exception when the return HTTP code from myspace is not 2xx, and unfortunately the message is embedded in HTML so the message might not work some day.

    Also it has some basic profiling built-in. You can set bProfiling = false to not go through, otherwise a print_r(Space::get_calls()) would give you an idea on how many calls and how long it took.

    The Key it the Application URI and the secret is below that on the application information.

    myspace-platform.tar.gz

  • 02-06-2008 3:04 PM In reply to

    • Nate
    • Top 100 Contributor
    • Joined on 02-05-2008
    • Posts 28

    Re: PHP Client Library

    Great work! Just a small issue with the downloaded file:

    Line 55 - 56 of Space.php

    THIS:
    return $this-> ($sQuery);

    SHOULD READ:
    return $this->do_request($sQuery);

    It's fantastic, Thanks!
    Filed under:
  • 02-06-2008 3:35 PM In reply to

    Re: PHP Client Library

     Help im getting this error

     

    Fatal error: Uncaught exception 'Exception' with message '401 ' in /home/.cassi/trevorallen/luinutz.com/facebook/freegames/client/Space.php:184 Stack trace: #0 /home/.cassi/trevorallen/luinutz.com/facebook/freegames/client/Space.php(143): Space->_do_request('users/34044043/...', Array) #1 /home/.cassi/trevorallen/luinutz.com/facebook/freegames/client/Space.php(132): Space->do_request('users/34044043/...') #2 /home/.cassi/trevorallen/luinutz.com/facebook/freegames/index.php(7): Space->status('34044043') #3 {main} thrown in /home/.cassi/trevorallen/luinutz.com/facebook/freegames/client/Space.php on line 184

  • 02-06-2008 3:39 PM In reply to

    • Ben
    • Not Ranked
    • Joined on 02-06-2008
    • Posts 1

    Re: PHP Client Library

    Is there an issue with the file? I seem to be unable to download it.

  • 02-06-2008 4:00 PM In reply to

    • Nate
    • Top 100 Contributor
    • Joined on 02-05-2008
    • Posts 28

    Re: PHP Client Library

     Try right-clicking and "Save Link/Target As"

  • 02-06-2008 4:03 PM In reply to

    • Jerome
    • Top 500 Contributor
    • Joined on 02-05-2008
    • Posts 7

    Re: PHP Client Library

    This would be an access problem, are you sure you have setup the Application URI to something that resolves. I've had issues when I used the myspace one but went through so many attemps that I'm not sure this was a problem.

    In _do_request around line 160 you can "print" the actual URL and paste in a browser, you might be able to get a better error message. As I was saying it's returning an HTML page and so fetching the error message out of there is a hack for sure. 

     

  • 02-06-2008 4:08 PM In reply to

    • Jerome
    • Top 500 Contributor
    • Joined on 02-05-2008
    • Posts 7

    Re: PHP Client Library

     That seems odd I am not seeing that problem and I just downloaded the file linked to make sure... Especially this one if for the "user" method which I have tested...

  • 02-06-2008 6:25 PM In reply to

    • Nate
    • Top 100 Contributor
    • Joined on 02-05-2008
    • Posts 28

    Re: PHP Client Library

    325661444:

     That seems odd I am not seeing that problem and I just downloaded the file linked to make sure... Especially this one if for the "user" method which I have tested...

    I'm not seeing that anymore either, maybe I broke it myself.  Stupid User Error :D

  • 02-07-2008 9:38 AM In reply to

    Re: PHP Client Library

    it works now 

  • 02-08-2008 2:19 AM In reply to

    • Buzz
    • Top 50 Contributor
    • Joined on 02-07-2008
    • Posts 49

    Re: PHP Client Library

     Library works awesome, thanks man!

  • 02-08-2008 3:54 PM In reply to

    Re: PHP Client Library

    So glad I found this thread. This library ROCKS!! You just saved me a bunch of work. Thanks. 

  • 02-12-2008 5:59 AM In reply to

    Re: PHP Client Library

    Fatal error: Uncaught exception 'Exception' with message '401 ' in /Users/roger/Sites/mysite/Space.php:185 Stack trace: #0 /Users/roger/Sites/mysite/Space.php(143): Space->_do_request('currentuser', Array) #1 /Users/roger/Sites/mysite/Space.php(50): Space->do_request('currentuser') #2 /Users/roger/Sites/mysite/index.php(6): Space->currentUser() #3 {main} thrown in /Users/roger/Sites/mysite/Space.php on line 185

     

    THat is all I seem to be able to get.. currentUser() being the attempted method this time.

    Let me note.. that I can do profile(profileIdOfAFriend) and it works.

     

    currentUser() just doesn't seem to work :)
     

  • 02-12-2008 7:38 AM In reply to

    • Paul
    • Top 500 Contributor
    • Joined on 02-05-2008
    • Posts 8

    Re: PHP Client Library

     I have the same issue as oreowookie ...:(

  • 02-12-2008 5:22 PM In reply to

    • edy
    • Not Ranked
    • Joined on 02-05-2008
    • Posts 2

    Re: PHP Client Library

    looking through the code I found a small bug in the profiling in do_request:

    self::$iTotal  == ($e-$s);

    should be

    self::$iTotal  = ($e-$s);

  • 02-12-2008 6:01 PM In reply to

    • Buzz
    • Top 50 Contributor
    • Joined on 02-07-2008
    • Posts 49

    Re: PHP Client Library

    oreowookie:

    Fatal error: Uncaught exception 'Exception' with message '401 ' in /Users/roger/Sites/mysite/Space.php:185 Stack trace: #0 /Users/roger/Sites/mysite/Space.php(143): Space->_do_request('currentuser', Array) #1 /Users/roger/Sites/mysite/Space.php(50): Space->do_request('currentuser') #2 /Users/roger/Sites/mysite/index.php(6): Space->currentUser() #3 {main} thrown in /Users/roger/Sites/mysite/Space.php on line 185

     

    THat is all I seem to be able to get.. currentUser() being the attempted method this time.

    Let me note.. that I can do profile(profileIdOfAFriend) and it works.

     

    currentUser() just doesn't seem to work :)
     

     

    I also receive a 401 but I say the fault is not the libary, since it works great with some user_ids, but not other (with the same code). See my particular problem here... discuss if you'd like..

    http://developer.myspace.com/Community/forums/t/209.aspx 

Page 1 of 9 (122 items) 1 2 3 4 5 Next > ... Last »