Problem with fopen! Please help!

apps

#1

Hi i recently bought a auto media script and tried to install it… But i cant install it coz the fopen is disabled and it needed to run the script. I read some discussion about fopen and they have the alternative for it which is curl but i dont know how to use it. Ive talked to the script developer and he said this “Tell your server administrators to trigger fopen to put in Curl touches me to make any new programming just tell them that you activate and operate”

Please help me coz i really wanted to install the script asap…

thanks and regards,
Kojak

Latest News - Celebrity News


#2

DreamHost will not do this, and that is a "Good Thing ™ ".

Allow_url_fopen is disabled on DreamHost for good reason. It is a poor security practice to allow it to be generally run on a shared server where one user’s exploitable code could compromise many other users.

The DreamHost wiki has information on how to deal with your problem other than using cURL (compiling your own version of PHP or using DH’s php-cgi with your own php.ini configuration), though using cURL is an infinitely better solution than enabling allow_url_fopen.

The programmer of your application should know this; the fact that he recommends otherwise doesn’t reflect favorable on his competence or his script. :wink:

Though the wiki provides instruction on how to enable allow_url_fopen, many find these procedures difficult to complete, and I do not recommend you using either of these procedures to enable url_fopen.

–rlparker


#3

And I’ve heard that if you’re on the server “coke” it doesn’t work even if you do get it right. (wink wink)

(not on my server you don’t)

Wholly - Use promo code WhollyMindless for full 97$ credit until 12/11/07.


#4

Now im lost… Please help me install curl at my server coz i really have no idea on how to do it… :frowning:

Latest News


#5

cURL is already installed at your server; there is no need to install it as it is already available.

In order to use cURL with your program, your program will have to be modified. While you have not told us what program you are using, you did say that you had “bought” it, so I suspect you may not be able to share the code with us, and you may even be prohibited by its license from modifying it.

If this code is not something that you can legally “share” with others, this makes it impossible for us to evaluate how difficult it would be to re-write it to use cURL instead of allow_url_fopen, or to actually modify the code if it was something someone here wanted to do.

Again, you should contact the author of the script and request a version that does not rely upon the availability of allow_url_fopen. When you buy proprietary code, without the ability to share it with others , you really have no other alternatives if you are not able to modify it yourself or modify your environment to facilitate running the code.

In many cases, you may not legally modify such code anyway, which leaves you with only the alternative of running in the environment the author supports.

Unfortunately, in this case, the DreamHost environment does not facilitate you running that program without modifying your PHP environment. It is possible to modify your environment to facilitate the use of allow_url_fopen, but, I’m sorry, I won’t help you do that as I feel that it is unwise to allow_url_fopen on a shared server and I support DreamHost’s having disabled it.

Edited to add this note:
This is the very same situation the you encountered back in August, with one important difference. In that case you were using “free” code that could be legally shared and modified, and we were able to provide a cURL based “fix” so you could run the program safely. In this case, you have purchased a program that, I presume, does not have a “free” license, and that prevents us from attempting the same fix this time around. :wink:

–rlparker


#6

I’ve had problems with fopen and found the following workaround via google (forgotten where the source url was as i just saved the snippet on my laptop)

function fread_url($url,$ref="") { if(function_exists("curl_init")){ $ch = curl_init(); $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; ". "Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt( $ch, CURLOPT_HTTPGET, 1 ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION , 1 ); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_REFERER, $ref ); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); $html = curl_exec($ch); curl_close($ch); } else{ $hfile = fopen($url,"r"); if($hfile){ while(!feof($hfile)){ $html.=fgets($hfile,1024); } } } return $html; } Which is then called in substitution of fopen as so:

$out = fread_url($url); What’s the community verdict? It worked fine when I tried it, but is it good practice? If so, maybe the developer of the media script could bob it in and change the references to fopen in the code.

Cheers,
Karl

web design, development & seo by DigitalVibe