Old 28-04-2007, 19:24   #1 (permalink)
erik.silkensen
Registered User
 
erik.silkensen's Avatar
 
Join Date: Apr 2007
Location: colorado, usa
Posts: 23
beginner php question

Hello,

I am starting to play around with PHP a little bit, but I'm having trouble with something:

I would like to read a site's source line by line. I can do this fine - but apparently only when the page I'm reading lives on the same server...

trying to load anything else raises a Connection refused error.

Here's the code I'm using:

Code:
$page = file_get_contents("url_here"); $lines = explode("\n", $page); for ($i = 0; $i < sizeof($lines); $i++) { $line = $lines[$i]; // do some stuff. . . }
Can anyone help me out!?

Thanks!
  Reply With Quote
Old 28-04-2007, 21:44   #2 (permalink)
gk
geek
 
gk's Avatar
 
Join Date: Oct 2006
Location: *.everywhere
Posts: 204
Send a message via ICQ to gk Send a message via AIM to gk Send a message via MSN to gk Send a message via Yahoo to gk
"allow_url_fopen" in your ini file might have something to do with it.

PHP: Filesystem Functions - Manual
  Reply With Quote
Old 29-04-2007, 22:07   #3 (permalink)
erik.silkensen
Registered User
 
erik.silkensen's Avatar
 
Join Date: Apr 2007
Location: colorado, usa
Posts: 23
I looked into it a little more and it looks like what you said would work -- but my host is sourceforge so I'm pretty sure it's not possible for me.
  Reply With Quote
Old 30-04-2007, 00:47   #4 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Yeah, they'd probably have allow_url_fopen off. It just makes sense.
  Reply With Quote
Old 30-04-2007, 11:58   #5 (permalink)
gk
geek
 
gk's Avatar
 
Join Date: Oct 2006
Location: *.everywhere
Posts: 204
Send a message via ICQ to gk Send a message via AIM to gk Send a message via MSN to gk Send a message via Yahoo to gk
Why do you want to do that anyway?
  Reply With Quote
Old 30-04-2007, 18:39   #6 (permalink)
erik.silkensen
Registered User
 
erik.silkensen's Avatar
 
Join Date: Apr 2007
Location: colorado, usa
Posts: 23
Well this probably isn't the best approach but...

my goal was to post a counter on my project's web page showing how many downloads its had. For the files hosted at sourceforge I just grabbed the numbers from the source of the download pages and echoed them into my site. Someone packaged the program for a linux distribution though so I wanted to add another counter for how many downloads the other version had at the other site.

I'm open to suggestions for how to do this though... I just kind of went at it and this was the first thing that came to mind.
  Reply With Quote
Old 30-04-2007, 23:58   #7 (permalink)
gk
geek
 
gk's Avatar
 
Join Date: Oct 2006
Location: *.everywhere
Posts: 204
Send a message via ICQ to gk Send a message via AIM to gk Send a message via MSN to gk Send a message via Yahoo to gk
do a redirect. so all the php file would do is log the download to your database/file then redirect the user to the real url.
  Reply With Quote
Reply



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

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8