Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
get a file not found error
Old 08-15-2004, 05:41 AM get a file not found error
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
when doing this

<?php
$filename = 'http://dlx.gamespot.com/homepage/topten_movie.html';
$fp = fopen($filename, "r");
$contents = fread($fp, filesize($filename));
fclose($fp);

it gives me a file not found error.
I cant seem to open any webfile.
what to do?
lajkonik86 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-15-2004, 06:50 AM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
older versions of PHP don't support open on remote files.
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Old 08-15-2004, 10:24 AM
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
any workaround?
lajkonik86 is offline
Reply With Quote
View Public Profile
 
Old 08-15-2004, 10:24 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
the fopen wrappers are more than likely turned off in php.ini
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-15-2004, 12:08 PM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
Same dif'. Tried using a socket?
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Old 08-15-2004, 01:35 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
I think Snoopy Might be of some use to you.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-16-2004, 05:51 AM
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen=On

It was set like this
should be able to open web files:S
lajkonik86 is offline
Reply With Quote
View Public Profile
 
Old 08-16-2004, 06:24 AM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
outdated? Try;

PHP Code:
$all_lines file("http://www.webworrks.com/index.php");

foreach(
$all_lines as $key=>$value) {
  echo 
"#$key: ".htmlspecialchars($value)."<br />\n";

__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Old 08-17-2004, 08:29 AM
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
This should get me started
thanks guys
lajkonik86 is offline
Reply With Quote
View Public Profile
 
Old 08-17-2004, 08:48 AM
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
hey webbworks
my php skills aren't very good
could you please explain your code.

Greetz
Thierry
lajkonik86 is offline
Reply With Quote
View Public Profile
 
Old 08-17-2004, 06:47 PM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
file() basically does fopen, fread, and fclose, and stores all the lines of data into an array. The you can do what you want with the array (in my example, echo'd them all with their line number, etc). htmlspecialchars() does stuff like replace < with &lt; so you can see the raw code... that was just to show you how to read the code in a remote document.

I used file() becuase I think it could support reading of remote documents before fopen(), so if your host is running older PHP it may help... not 100% sure though.
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Old 08-18-2004, 04:26 AM
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
what about the $key and $value
both created by the file function?
lajkonik86 is offline
Reply With Quote
View Public Profile
 
Old 08-18-2004, 10:45 AM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
yes, because the info is stored as an array. In a 2-d array, (or do I mean 1-d? anyways...), you have information like this;

$all_lines[1] = "<html>";
$all_lines[2] = "<head>";

.....and so on. Thus, when you do foreach, $key = 1,2, etc, and value="<html>", "<head>", etc. That understandable?
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Old 08-18-2004, 11:06 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
lajkonik, what might help you understand the way the array is layed out better is to do something along the lines of this...

echo '<pre>';
print_r($all_lines);
echo '</pre>';

And view that in the browser.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-18-2004, 01:12 PM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
Winky is full of solutions
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Old 08-19-2004, 04:42 AM
lajkonik86's Avatar
Ultra Talker

Posts: 389
Trades: 0
got it

thanks for the help guys
lajkonik86 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to get a file not found error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47054 seconds with 12 queries