Dynadot โ€” .com Registration $8.99

[Resolved] Fopen a secure area

Spaceship Spaceship
Watch
Impact
44
fopen a secure area

What I'm trying to do is something like this:

PHP:
$fh = fopen("http://USER:[email protected]/something.cgi", 'r') or die("ERROR");
fclose($fh);

Thing is, I keep getting errors like it could not login/open the file. Any ideas how I could do this. I don't necessarily have to use fopen, although I tried file_get_contents and it still didn't work.

Any help is much appreciated :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Last edited:
0
•••
Doesn't seem to be working, included the class & used the above example but it doesn't seem to be doing anything at all. Doesn't even show any errors on the page.

I thought fopen should work, but it doesn't for some reason.

Edit, this is the error I get using fopen (I don't get anything using your curl class)

Code:
Warning: fopen(http://...@<domain>/<file>.cgi) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized in /file/folder/reboot.php on line 44

And line 44 is:
PHP:
$fh = fopen("http://USER:[email protected]/file.cgi", 'r') or die("ERROR");
fclose($fh);

I have also doubled checked copy & pasting the site (http://USER:[email protected]/file.cgi) and it loads just fine.
 
Last edited:
0
•••
Well, using what I posted, $data would have everything from the page you're trying to get. You need to echo it to show it.

I tested it logging into cPanel and it worked.
 
1
•••
Dan said:
Well, using what I posted, $data would have everything from the page you're trying to get. You need to echo it to show it.

I tested it logging into cPanel and it worked.

Ah, got it to work. In $data I put http// instead of http:// which is the reason why it didn't work.

Thanks for your help, rep coming your way!
 
0
•••
Curl is faster... and much better to use
 
0
•••
Jawn said:
Curl is faster... and much better to use

That's what I ended up using.

Thanks!
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back