Jump to content


Photo

[SOLVED] accessing "http://www.domain.com:2082/.." with fopen()


  • Please log in to reply
2 replies to this topic

#1 elias

elias
  • Members
  • PipPip
  • Member
  • 20 posts
  • LocationSpain

Posted 25 February 2006 - 07:03 PM

Hi guys and gals

I hope you are all enjoying this weekend.

I am messing around with my raw logs and am having a bit or a problem accessing them in the first place...

I am doing tests with the following code:

$handle = fopen("http://www.domain.com/uploads/accesslog_domain.com_2_25_2006.gz", "r");

which works fine when I manually place the logs in this "uploads" directory, but that is not where they normally reside, when I go to my cPanel and ask to view them, I am sent to:

"http://www.domain.co...m_2_25_2006.gz"

to download them.

What I would ideally want is for my script to access the logs directly here, hence something like this is what I tried:

$handle = fopen("http://www.domain.com:2082/getaccesslog/accesslog_domain.com_2_25_2006.gz", "r");

But as luck would have it, it gives me a error something like:

Warning: fopen(http://www.domain.co...om_2_25_2006.gz) [function.fopen]: failed to open stream: HTTP request failed!

So, I imagine that the php code cannot access the file because it is referred to with port number... and here I am lost.

Does anyone know how I could access the file from teh script - I can dowload it if I just copy and paste the [a href=\"http://www.domain.com:2082/getaccesslog/accesslog_domain.com_2_25_2006.gz\" target=\"_blank\"]http://www.domain.com:2082/getaccesslog/ac...om_2_25_2006.gz[/a] url, so there is no problem with the file as such, its the script's ability to access it.

Anyhow, I hope someone can point me in the right direction.

take care and all the best

elias

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 25 February 2006 - 09:48 PM

You have to login to use cPanel, and therefor access your logs.

Because of that you will not be able to directly access them from php, at least not to my knowledge. You may consider looking more indepth at cURL, as I am not terribly familiar with it's full capabilities.

[a href=\"http://us3.php.net/manual/en/ref.curl.php\" target=\"_blank\"]http://us3.php.net/manual/en/ref.curl.php[/a]

#3 elias

elias
  • Members
  • PipPip
  • Member
  • 20 posts
  • LocationSpain

Posted 27 February 2006 - 10:22 AM

[!--quoteo(post=349390:date=Feb 25 2006, 10:48 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Feb 25 2006, 10:48 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
You have to login to use cPanel, and therefor access your logs.

Because of that you will not be able to directly access them from php, at least not to my knowledge. You may consider looking more indepth at cURL, as I am not terribly familiar with it's full capabilities.

[a href=\"http://us3.php.net/manual/en/ref.curl.php\" target=\"_blank\"]http://us3.php.net/manual/en/ref.curl.php[/a]
[/quote]


Hi hitman6003

Thanks for your help, but unfortunately I have no access to the PHP server - I am just a mere paying customer, and hence I have no possibility to install any extra libraries etc. as stipulated in your link.

Also, I am aware that the cPanel needs user access, but I thougth that once I had logged-in into my cPanel area, I did not need to reenter my user name and password again, in fact once I am in a session in my cPanel area, I can copy/paste the URL of where the raw logs are and I can access them with my browser with no problem.

I guess the question arises if from where the code is being run, does it have access to my session...?? dunno, and this is where my knowledge hits a wall.

Basically, for anyone else reading this post anew, once in a cPanel session, I can access the raw logs file:

[a href=\"http://www.domain.com:2082/getaccesslog/accesslog_domain.com_2_25_2006.gz\" target=\"_blank\"]http://www.domain.com:2082/getaccesslog/ac...om_2_25_2006.gz[/a]

but the code I have prepared to read this file cannot.

Any other ideas, like do any "server-masters" know which is the actual path of this file, like I tried:

"/home/mydomain/public_html/getaccesslog/accesslog_domain.com_2_25_2006.gz"

but it was clearly wrong... through my FTP access I cant find (I have no access to) the directory "getaccesslog" but does anyone know where these raw logs reside???

cheers and TIA again

elias




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users