NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [resolved] fopen a secure area

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-20-2007, 09:37 PM THREAD STARTER               #1 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse

fopen a secure area


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

PHP Code:
$fh fopen("http://USER:PASSWORD@domain.com/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.
????: NamePros.com http://www.namepros.com/programming/330116-resolved-fopen-a-secure-area.html

Any help is much appreciated
Camron is offline  
Old 05-20-2007, 09:40 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
http://www.namepros.com/code/257265-curl-class.html
$curl->set_userpass("user:pass");
$data = $curl->get("http://domain.com/something.cgi");

I think that should work (and what you did should work, too?).
Last edited by Dan; 05-20-2007 at 09:45 PM.
Dan is offline  
Old 05-20-2007, 09:47 PM THREAD STARTER               #3 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse
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 Code:
$fh fopen("http://USER:PASS@domain.com/file.cgi"'r') or die("ERROR");
????: NamePros.com http://www.namepros.com/showthread.php?t=330116
fclose($fh); 
I have also doubled checked copy & pasting the site (http://USERASS@domain.com/file.cgi) and it loads just fine.
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Last edited by Camron; 05-20-2007 at 09:53 PM.
Camron is offline  
Old 05-20-2007, 10:00 PM   #4 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
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.
Dan is offline  
Old 05-20-2007, 11:08 PM THREAD STARTER               #5 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse
Originally Posted by Dan
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.
????: NamePros.com http://www.namepros.com/showthread.php?t=330116

Thanks for your help, rep coming your way!
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Camron is offline  
Old 05-21-2007, 02:16 AM   #6 (permalink)
Straight from Sweden
 
Jawn's Avatar
Join Date: Oct 2006
Location: Sweden
Posts: 202
Jawn has a spectacular aura aboutJawn has a spectacular aura aboutJawn has a spectacular aura about
 


Animal Rescue
Curl is faster... and much better to use
__________________
Second place in seoworldchampionship 2007.
Jawn is offline  
Old 05-21-2007, 02:18 AM THREAD STARTER               #7 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse
Originally Posted by Jawn
Curl is faster... and much better to use
That's what I ended up using.

Thanks!
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Camron is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 03:38 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger