[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 05-20-2007, 08:37 PM   #1 (permalink)
Senior Member
 
Camron's Avatar
 
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,059
24.85 NP$ (Donate)

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.

Any help is much appreciated
Camron is offline  
Old 05-20-2007, 08:40 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

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 08:45 PM.
Dan is offline  
Old 05-20-2007, 08:47 PM   #3 (permalink)
Senior Member
 
Camron's Avatar
 
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,059
24.85 NP$ (Donate)

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");
fclose($fh);
I have also doubled checked copy & pasting the site (http://USER:PASS@domain.com/file.cgi) and it loads just fine.
__________________
|| VPSByte Virtual & Dedicated Solutions
|| True 24/7/365 support with a 1 hour guaranteed response time!
|| We offer budget, yet powerful dedicated servers and vps solutions.
|| All servers come w/ 10Mbps unmetered bandwidth & lite management standard.

Last edited by Camron; 05-20-2007 at 08:53 PM.
Camron is offline  
Old 05-20-2007, 09:00 PM   #4 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

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, 10:08 PM   #5 (permalink)
Senior Member
 
Camron's Avatar
 
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,059
24.85 NP$ (Donate)

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
Quote:
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.

Thanks for your help, rep coming your way!
__________________
|| VPSByte Virtual & Dedicated Solutions
|| True 24/7/365 support with a 1 hour guaranteed response time!
|| We offer budget, yet powerful dedicated servers and vps solutions.
|| All servers come w/ 10Mbps unmetered bandwidth & lite management standard.
Camron is offline  
Old 05-21-2007, 01:16 AM   #6 (permalink)
Straight from Sweden
 
Jawn's Avatar
 
Join Date: Oct 2006
Location: Sweden
Posts: 206
100.00 NP$ (Donate)

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, 01:18 AM   #7 (permalink)
Senior Member
 
Camron's Avatar
 
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,059
24.85 NP$ (Donate)

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
Quote:
Originally Posted by Jawn
Curl is faster... and much better to use
That's what I ended up using.

Thanks!
__________________
|| VPSByte Virtual & Dedicated Solutions
|| True 24/7/365 support with a 1 hour guaranteed response time!
|| We offer budget, yet powerful dedicated servers and vps solutions.
|| All servers come w/ 10Mbps unmetered bandwidth & lite management standard.
Camron is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 10:40 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85