martinbean / dribbble-php

PHP client library for the Dribbble API.
Other
81 stars 14 forks source link

Problem with my server? #6

Closed davewhitley closed 12 years ago

davewhitley commented 13 years ago

Hello, I am having trouble. Is there a way to check my sever and see if it has the required software/settings? I know it has PHP. I have gotten your code to work on a sever, but when I moved it to another sever it failed, even after checking links. Also, the source files for the project don’t work on this new server. I think the server is the problem.

Here is the error showing up in the source files for this project:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /misc/28/000/215/334/9/user/web/davewhitley.com/dribbble/src/base.php on line 32

Warning: file_get_contents(http://api.dribbble.com//shots/popular?page=1&per_page=3) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /misc/28/000/215/334/9/user/web/davewhitley.com/dribbble/src/base.php on line 32

Warning: Invalid argument supplied for foreach() in /misc/28/000/215/334/9/user/web/davewhitley.com/dribbble/src/base.php on line 33

Warning: Invalid argument supplied for foreach() in /misc/28/000/215/334/9/user/web/davewhitley.com/dribbble/examples/general.php on line 34
davewhitley commented 13 years ago

you can check your source files at

http://www.davewhitley.com/dribbble/examples/general.php

and my implementation at

http://www.davewhitley.com/about/index.php

martinbean commented 13 years ago

Hi,

Thanks for getting in touch. I will check PHP's documentation and see what extension is necessary and make sure this is added to the (admittedly limited) documentation, and advise you further.

Regards, Martin

martinbean commented 13 years ago

In the meantime, can you confirm if you have the cURL extension installed? You should be able to determine so by placing a phpinfo file on your server, but do make sure you remove it when finished.

davewhitley commented 13 years ago

Wow, thank you so much for the response! Yes, the cURL support is enabled

martinbean commented 13 years ago

Hi Dave,

I'll re-write the wrapper slightly to also support cURL in the case where a file_get_contents() call fails.

Regards, Martin

davewhitley commented 13 years ago

Thank you very much!

davewhitley commented 13 years ago

Hey, I have found out that 'url fopen' is disabled on my sever. Is that connected with my problem?

martinbean commented 13 years ago

Hi, sorry for the delayed reply. Yes, I believe file_get_contents() and related functions are affected by the option 'url fopen'.

davewhitley commented 13 years ago

Yep that fixed it.

RudyRosciglione commented 12 years ago

Hi! I've currently the same problem. You could visit my page here : http://rudyrosciglione.com/beta/rudyr_2011_version2/ I can't understand why Dribble import works in local server with Mamp and can't work on my ftp. :s Please help me!

martinbean commented 12 years ago

Hi Rudy. As above, check url_fopen is enabled on your live server.

Chances are it is in your localhost (Mamp) but not your live environment.

RudyRosciglione commented 12 years ago

Thank you but where can i check if " url_fopen " is available on my live server ? i'm on ovh.com

martinbean commented 12 years ago

Either your hosting provider can tell you, or you can upload a PHP script to your server with the following contents:

<?php phpinfo(); ?>

And that will tell you what options are enabled and what aren't.

Make sure you delete this script after viewing though, as unscrupulous visitors who stumble across it may use it to find weaknesses in your server set-up and use it in hacking attempts.

RudyRosciglione commented 12 years ago

Ok. i'm on my script. i'm check :

martinbean commented 12 years ago

You're not on an ADSL line by any chance, are you...?

RudyRosciglione commented 12 years ago

At the moment i'm on public host post but I don't see the problem there would be between the internet and my server. while locally everything works fine. Do you mind that my server could to be on adsl because i think saw it before on ovh.com ( user back office )

martinbean commented 12 years ago

The reason I asked about ADSL is because of this comment on the official PHP website: http://php.net/manual/en/function.fopen.php#33228

RudyRosciglione commented 12 years ago

Adsl/Sdsl aren't available on Pvh.com when i click on icon i lived page for : https://www.ovh.com/managerv5/ But i think that it's beta version because i can't have Adsl/Sdsl access.. Well I'll see what I can do with your link! Thank! :)

bradyjfrey commented 12 years ago

Just a heads up, thanks for this thread - Media Temple disabled allow_url_fopen by default on their grid servers now: http://kb.mediatemple.net/questions/793/Why+is+allow_url_fopen+disabled+on+the+(gs)+Grid-Service%3F

Even going so far as to recommend not to use it. They do allow you to override the service still, though: http://kb.mediatemple.net/questions/137/How+can+I+edit+php.ini+file%3F#gs

For any of you designers out there struggling with that error, it should be easy to fix for a while at least. Thank you, and thank you martinbean for the excellent dribbble-php!

martinbean commented 12 years ago

Thanks for that resource, brad. I'll look at alternative solutions to file_get_contents of fetching external content and push a fix soon thereafter.

BeatLaG commented 12 years ago

Hi Martin, I have the same problem. I was using your awesome script for a long time but since a few days to this part seems something is broken and don´t working correctly. Have you any improvement for this?

Anyway, keep on with that great work!

Thanks a lot! :)

martinbean commented 12 years ago

I'm currently working on version 2 of the PHP wrapper.

BeatLaG commented 12 years ago

Hi Martin, I don´t want to be inconsiderate, I appreciate a lot your hard work. But could you stimate how long/time this V2 would need to be written?

Anyway, thanks a lot for improve it!

martinbean commented 12 years ago

I'm hoping to have it wrapped up by New Year; I've already got most of it done.

BeatLaG commented 12 years ago

That sounds great!

Thanks, Martin!

martinbean commented 12 years ago

You should find version 2.0 in the repository now.

txcajun commented 12 years ago

Hi Martin,

Thank you for your hard work on resolving this issue. I too am experiencing some weird errors with my dribbble feed.

I've updated to version 2.0 but now get the following:

Fatal error: Cannot redeclare class DribbbleException in /nfs/c09/h01/mnt/129375/domains/bjuneau.com/html/includes/src/dribbble.php on line 22

Thanks for the help!

BeatLaG commented 12 years ago

Martin, I can´t/don´t know how to run correctly my application with the new updated file.

Could you make an example of how to show the player info with a list of shots for this player?

Thanks anyway!

EDITED: I didn´t know how to use try. Fixed and working! Great work martin. Thanks a lot! :)

martinbean commented 12 years ago

@bjuneau Could you open a new issue, with some more information, please? Thanks.

martinbean commented 12 years ago

@BeatLaG The updated docs show you how to fetch your shots:

<?php

require '../src/dribbble.php';

$dribbble = new Dribbble();

try {
    $my_shots = $dribbble->get_player_shots('martinbean');
    foreach ($my_shots->shots as $shot) {
        echo '<li><a href="' . $shot->url . '">' . $shot->title . '</a></li>';
    }
}
catch (DribbbleException $e) {
    echo 'Error: ' . $e->getMessage();
}

Obviously replace martinbean with your Dribbble username.

BeatLaG commented 12 years ago

Yes, I did it as your example in documentation and works great!

Thanks a lot!

martinbean commented 12 years ago

@BeatLaG Glad to hear it. Any other problems, feel free to create a new Issue.