Jump to content

Recommended Posts

Posted

Hello,

 

On the features page of heliohost's php hosting the following is stated:

 

- We don't allow users to access files outside their allocated disk space. The security risk is pretty obvious here.

 

I understand the security risk in terms of being able to access other users' files, but I believe this is the reason why I cannot open url with fopen. As alternative I could use the curl library, but this has the disadvantage that first the complete html page needs to be loaded before you can read the information.

 

Is there something to do about this?

 

Kind regards,

opensoftwaredev

Posted

Thanks Byron for the reply, I wasn't aware of these functions yet, alltough they have the same functionality as curl, opening a complete file into a variable, which can take a long time if the page is big.

 

Next to that I'm not in doubt that fopen works, only when I try to open a url I get 0 response.

Posted
Thanks Byron for the reply, I wasn't aware of these functions yet, alltough they have the same functionality as curl, opening a complete file into a variable, which can take a long time if the page is big.

 

file_put_contents and file_get_contents are taking the place of fopen and fwrite. There's no difference in the amount of time, not that I've noticed.

 

Next to that I'm not in doubt that fopen works, only when I try to open a url I get 0 response.

 

I just tested this on my site and it works fine:

 

<?php
$file = fopen("index.html","w");
fwrite($file, "<html><body bgcolor=\"blue\" text=\"white\">Hello World!</body></html>");
fclose($file);
?>

 

 

Posted

I'm sure that would work since that is local. Maybe I should have been more specific with "url". I ment an external URL, like

www.google.com/search?filter=0&hl=en&num=50&start=0&q=asdf

 

On my local webserver this works, but not on heliohost (yet)

 

file_put_contents and file_get_contents are taking the place of fopen and fwrite. There's no difference in the amount of time, not that I've noticed.

PHP.net: fopen

fopen() binds a named resource, specified by filename , to a stream.

After this you can read the stream line by line with fgets() and execute code accordingly. This is diferent from

PHP.net: file_get_contents

Reads entire file into a string

where you have to walk trough your output string after the complete page was downloaded. Especially with huge open directories (which I also want to open) this takes way more time, believe me.

 

Thanks a lot for the effort of trying though! Could you try an external link for me?

Posted

Thanks for demonstrating that, and you're right, it just works. The thing was that my script didn't give me the results I hoped for because of the following reason:

 

Google

Your client does not have permission to get URL /search?filter=0&hl=en&num=1&start=0&q=%22Simon%20and%20Garfunkel%22%20-%20%22Boxer%22 from this server. (Client IP address: *.*.*.* (no worries djbob))

 

I'll have to find another workaround for this one.

 

Thanks for the support Byron!

Posted

Thanks mate! I'll try to find another host where it is possible, which I probably won't find for free, and then I will modify my code using CURL.

Posted

So funny that it DOES work with CURL, but maybe in the future Google will block that too??

 

Anyway, now that it is working, maybe you can use it if you like:

 

http://openmp3.heliohost.org

 

It searches open-directories for mp3 and with help of javascript it makes a table of links in those directories, corresponding to the search query. It sorts the table on relevance.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...