WordPress.org

Ready to get started?Download WordPress

Forums

Savrix Play Store
[resolved] use cURL instead of file_get_contents() (8 posts)

  1. TamCore
    Member
    Posted 1 year ago #

    Hey,

    I've rewritten the sav_get_file() function to use PHP's cURL function if available with a fallback to file_get_contents.

    Source is available on github

    It would be nice if you could include my changes in the next release.

    http://wordpress.org/extend/plugins/savrix-android-market/

  2. Andreas Voetz
    Member
    Posted 1 year ago #

    Hi, I´ve tried to replace the function, but I am getting an Error:

    Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /webs/7/5/70/10/10757/web1/androidtv/wp-content/plugins/savrix-android-market/savrix-android-market.php on line 33

    Any suggestions?

    Greetimgs from germany
    Andy

  3. captainstu72
    Member
    Posted 1 year ago #

    Just curious, what difference would this make?

  4. TamCore
    Member
    Posted 1 year ago #

    Sorry for the late reply.

    @Andreas Voetz: You can ignore this warning. CURLOPT_FOLLOWLOCATION isn't needed and I've removed it from the code I've linked in the OP.

    @captainstu72: Not all webservers allow opening files on remote servers via file_get_contents(); fopen(); etc. This change tries to fetch the information via PHP's cURL plugin, which isn't affected by the described limitations.

  5. cezars
    Member
    Posted 1 year ago #

    could you post plugin with your changes ?

  6. savrix85
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry for the late reply. I tried to implement the cURL, but it seems to ignore the Accept Language header. Despite I set "en" or "en-us" as language, it uses the language from the server where the website is located.

  7. savrix85
    Member
    Plugin Author

    Posted 1 year ago #

    I found why. Google mainly uses the IP to determine in which language to show you the page, so, even if I set accept-language:en, Google sends the page in the server location language.

    Maybe I found a trick to force the language.

  8. cezars
    Member
    Posted 1 year ago #

    good :D

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.