Scholieren.com forum

Scholieren.com forum (https://forum.scholieren.com/index.php)
-   Software & Hardware (https://forum.scholieren.com/forumdisplay.php?f=20)
-   -   [PHP] Alternatief voor fopen/file_get_contents (https://forum.scholieren.com/showthread.php?t=830933)

Dr HenDre 06-05-2004 11:33

[php] alternatief voor fopen/file_get_contents
 
Ik heb op mn gratis lycos account een script draaien voor iemand(wat ik overigens zelf heb gemaakt :)) maar nu opent het script met fopen een url. Op mn localhost doet ie dat wel, maar op lycos niet omdat allow_url_fopen uit staat.

Nu is mijn vraag, is er een alternatief hiervoor, zodat ik toch een extern bestand in kan lezen.

En ow ja, corn jobs is ook geen optie :(

het gaat om de volgende stuk code
PHP-code:

$program "http://www.eter.tv/arm/programs/print_version/a_Atvsput.shtml"
$content =  file_get_contents($program);
?> 

de instellingen van php/apache staan op http://members.lycos.nl/hendre/phpinfo.php

Triloxigen 06-05-2004 11:41

Op http://php.net/file_get_contents kun je lezen waarom het niet werkt..

Maar gebruik fopen :)

Dr HenDre 06-05-2004 11:45

Citaat:

********** schreef op 06-05-2004 @ 12:41 :
Op http://php.net/file_get_contents kun je lezen waarom het niet werkt..

Maar gebruik fopen :)

ik zal het effe met fopen proberen, maar ben bang dat dat niet werkt omdat phpinfo() het volgende zegt:

allow_url_fopen Off

nope, fopen/fread werkt dus ook niet :)
PHP-code:

  $program "http://www.eter.tv/arm/programs/print_version/a_Atvsput.shtml";
  
$handle fopen($program"r");
  
$content fread($handle100000);
  
fclose($handle); 

terwijl dit lokaal perfect werkt :)

Manuzhai 06-05-2004 12:07

Zie ook je GoT topic. :P

Dr HenDre 06-05-2004 12:45

Citaat:

Manuzhai schreef op 06-05-2004 @ 13:07 :
Zie ook je GoT topic. :P
zie reply daar ;)
fsockopen is een van de functies die disabled is :(

Orion 06-05-2004 14:04

met file() en implode()

mag dat wel?

PHP-code:

<?php
$program 
"http://www.eter.tv/arm/programs/print_version/a_Atvsput.shtml";  
$content =  implode(""file($program)); 
?>


Dr HenDre 06-05-2004 15:59

Citaat:

Orion schreef op 06-05-2004 @ 15:04 :
met file() en implode()

mag dat wel?

PHP-code:

<?php
$program 
"http://www.eter.tv/arm/programs/print_version/a_Atvsput.shtml";  
$content =  implode(""file($program)); 
?>


nope, ook dát werkt niet :(

op Got kwam iemand met het idee om sockets te gebruiken (socket_create, socket_connect enz). Maar dat is denk ik de laatste oplossing. Iemand hier nog een idee?

Enlightenment 06-05-2004 16:07

Ja duh dat soort prut schakelen ze uit natuurlijk. Gratis PHP is natuurlijk béétje discutabel, want ze spijkeren dat ding echt wel dicht.

Nee, beter betaal je paar euro per maand als je goede hosting wilt. Of je moet zelf hosten, dat kan ook prima als je 1Mbps upstream hebt. :)

Dr HenDre 06-05-2004 16:59

Citaat:

Enlightenment schreef op 06-05-2004 @ 17:07 :
Ja duh dat soort prut schakelen ze uit natuurlijk. Gratis PHP is natuurlijk béétje discutabel, want ze spijkeren dat ding echt wel dicht.

Nee, beter betaal je paar euro per maand als je goede hosting wilt. Of je moet zelf hosten, dat kan ook prima als je 1Mbps upstream hebt. :)

hmm, het gaat dus om max 10 pageviews per week. Het is een tv programma waarvan de tijden zoveel uur vooruit of achteruit worden gezet. En degene die hiervan af zullen weten dat zijn hoogstens 3 of 4 mensen.

Kan iemand de 2 bestandjes voor me hosten :( ?
dit is de code mocht je me aan een hosting willen helpen :)
PHP-code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!-- Creation Date: <?=Date("d/m/Y")?> -->
<head>

<meta name="Generator" content="Dev-PHP 1.9.4">
<title>Document Title</title>

<SCRIPT LANGUAGE="JavaScript">
<!--
  function formHandler()
  {
    var URL = document.form.site.options[document.form.site.selectedIndex].value;
    window.location.href = URL;
  }
-->
</SCRIPT>

</head>
<body>
<FORM name = "form">
<SELECT NAME="site" SIZE=1 onChange ="formHandler()">
<OPTION VALUE="" selected>Kies uw tijdzone...
<OPTION VALUE="index.php?gmt=-12">GMT -12 Eniwetok, Kwajalein
<OPTION VALUE="index.php?gmt=-11">GMT -11 Midway Island, Samoa
<OPTION VALUE="index.php?gmt=-10">GMT -10 Hawaii
<OPTION VALUE="index.php?gmt=-9">GMT -9 &nbsp;Alaska
<OPTION VALUE="index.php?gmt=-8">GMT -8 &nbsp;Pacific Time (US & Canada)
<OPTION VALUE="index.php?gmt=-7">GMT -7 &nbsp;Arizona, Mountain Time (US & Canada)
<OPTION VALUE="index.php?gmt=-6">GMT -6 &nbsp;Centraal-Amerika, Central Time (US & Canada), Mexico Stad
<OPTION VALUE="index.php?gmt=-5">GMT -5 &nbsp;Bogot, Lima, Quito, Eastern Time (US & Canda)
<OPTION VALUE="index.php?gmt=-4">GMT -4 &nbsp;Atlantic Time (Canada), Carcas, La Paz, Santiago
<OPTION VALUE="index.php?gmt=-3">GMT -3 &nbsp;Brasilia, Buenos Aires, Georgetown, Groenland
<OPTION VALUE="index.php?gmt=-2">GMT -2 &nbsp;Mid-Atlantic
<OPTION VALUE="index.php?gmt=-1">GMT -1 &nbsp;Azoren
<OPTION VALUE="index.php?gmt=0">GMT &nbsp;&nbsp;&nbsp;&nbsp;Casablance, Dublin, Edinburgh, Lissabon, Londen
<OPTION VALUE="index.php?gmt=1">GMT +1  Amsterdam, Berlijn, Bern, Rome, Stockholm, Brussel, Parijs
<OPTION VALUE="index.php?gmt=2">GMT +2  Athene, Istanboel, Minsk, Boekarest, Cairo, Helsinki, Jeruzalem
<OPTION VALUE="index.php?gmt=3">GMT +3  Bagdad, Koeweit, Moskou, St. Petersburg, Tehran
<OPTION VALUE="index.php?gmt=4">GMT +4  Bakoe, Tiflis, Yerevan, Muscat, Kaboel
<OPTION VALUE="index.php?gmt=5">GMT +5  Ekatinburg, Islamabad, Karachi, Calcutta
<OPTION VALUE="index.php?gmt=6">GMT +6  Almathy, Novosibirsk
<OPTION VALUE="index.php?gmt=7">GMT +7  Bankok, Jakarta, Krasnoyarsk
<OPTION VALUE="index.php?gmt=8">GMT +8  Bejing, Hong Kong, Kula Lumpur, Singapore, Taiwan
<OPTION VALUE="index.php?gmt=9">GMT +9  Tokio, Seoul, Darwin
<OPTION VALUE="index.php?gmt=10">GMT +10 Melbourne, Sydney, Canberra
<OPTION VALUE="index.php?gmt=11">GMT +11 Magadan, Solomon Island
<OPTION VALUE="index.php?gmt=12">GMT +12 Auckland, Wellington
</SELECT>
</FORM>
<?php

  
//set GMT +1 if param gmt is not enterd or invalid
  
if(!isset($_GET['gmt']) || !is_numeric($_GET['gmt']))
    
$gmt_x 1;
  elseif(isset(
$_GET['gmt']) && is_numeric($_GET['gmt']))
    
$gmt_x $_GET['gmt'];

  
//connect to site and read content
  
$program "http://www.eter.tv/arm/programs/print_version/a_Atvsput.shtml";
  
$content =  file_get_contents($program);

  
//replace local linked images by aboslute images
  
$content str_replace("/selectprogram/images/printer.gif""http://www.eter.tv/selectprogram/images/printer.gif"$content);
  
$content str_replace("/selectprogram/images/folder.gif""http://www.eter.tv/selectprogram/images/folder.gif"$content);

  
//adjust the time
  
function add_x_hours($match)
  {
    global 
$gmt_x;
    
$match[1] += $gmt_x 4//-4 to get GMT time
    
$match[1] %= 24//modulo 24 to avoid hours > 24
    
if($match[1] < 0)
      
$match[1] = 24 abs($match[1]);
    
$tijd $match[1].".".$match[2]; //melt hours with minutes
    
return $tijd;
  }
  
//regex pattern
  
$pattern "|(\d{2}).(\d{2})[ ](<\/font>)|";
  echo 
preg_replace_callback($pattern"add_x_hours"$content);
  
  echo 
"<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=1>
        <br />Time adjustments implented by <a href=\"mailto:drhendre@hotmail.com\">Henri Hambarsumyan</a></font>"
;
?>

</body>
</html>


Marcus 06-05-2004 19:20

Citaat:

Dr HenDre schreef op 06-05-2004 @ 17:59 :
hmm, het gaat dus om max 10 pageviews per week. Het is een tv programma waarvan de tijden zoveel uur vooruit of achteruit worden gezet. En degene die hiervan af zullen weten dat zijn hoogstens 3 of 4 mensen.

Kan iemand de 2 bestandjes voor me hosten :( ?
dit is de code mocht je me aan een hosting willen helpen :)
PHP-code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!-- Creation Date: <?=Date("d/m/Y")?> -->
<head>

<meta name="Generator" content="Dev-PHP 1.9.4">
<title>Document Title</title>

<SCRIPT LANGUAGE="JavaScript">
<!--
  function formHandler()
  {
    var URL = document.form.site.options[document.form.site.selectedIndex].value;
    window.location.href = URL;
  }
-->
</SCRIPT>

</head>
<body>
<FORM name = "form">
<SELECT NAME="site" SIZE=1 onChange ="formHandler()">
<OPTION VALUE="" selected>Kies uw tijdzone...
<OPTION VALUE="index.php?gmt=-12">GMT -12 Eniwetok, Kwajalein
<OPTION VALUE="index.php?gmt=-11">GMT -11 Midway Island, Samoa
<OPTION VALUE="index.php?gmt=-10">GMT -10 Hawaii
<OPTION VALUE="index.php?gmt=-9">GMT -9 &nbsp;Alaska
<OPTION VALUE="index.php?gmt=-8">GMT -8 &nbsp;Pacific Time (US & Canada)
<OPTION VALUE="index.php?gmt=-7">GMT -7 &nbsp;Arizona, Mountain Time (US & Canada)
<OPTION VALUE="index.php?gmt=-6">GMT -6 &nbsp;Centraal-Amerika, Central Time (US & Canada), Mexico Stad
<OPTION VALUE="index.php?gmt=-5">GMT -5 &nbsp;Bogot, Lima, Quito, Eastern Time (US & Canda)
<OPTION VALUE="index.php?gmt=-4">GMT -4 &nbsp;Atlantic Time (Canada), Carcas, La Paz, Santiago
<OPTION VALUE="index.php?gmt=-3">GMT -3 &nbsp;Brasilia, Buenos Aires, Georgetown, Groenland
<OPTION VALUE="index.php?gmt=-2">GMT -2 &nbsp;Mid-Atlantic
<OPTION VALUE="index.php?gmt=-1">GMT -1 &nbsp;Azoren
<OPTION VALUE="index.php?gmt=0">GMT &nbsp;&nbsp;&nbsp;&nbsp;Casablance, Dublin, Edinburgh, Lissabon, Londen
<OPTION VALUE="index.php?gmt=1">GMT +1  Amsterdam, Berlijn, Bern, Rome, Stockholm, Brussel, Parijs
<OPTION VALUE="index.php?gmt=2">GMT +2  Athene, Istanboel, Minsk, Boekarest, Cairo, Helsinki, Jeruzalem
<OPTION VALUE="index.php?gmt=3">GMT +3  Bagdad, Koeweit, Moskou, St. Petersburg, Tehran
<OPTION VALUE="index.php?gmt=4">GMT +4  Bakoe, Tiflis, Yerevan, Muscat, Kaboel
<OPTION VALUE="index.php?gmt=5">GMT +5  Ekatinburg, Islamabad, Karachi, Calcutta
<OPTION VALUE="index.php?gmt=6">GMT +6  Almathy, Novosibirsk
<OPTION VALUE="index.php?gmt=7">GMT +7  Bankok, Jakarta, Krasnoyarsk
<OPTION VALUE="index.php?gmt=8">GMT +8  Bejing, Hong Kong, Kula Lumpur, Singapore, Taiwan
<OPTION VALUE="index.php?gmt=9">GMT +9  Tokio, Seoul, Darwin
<OPTION VALUE="index.php?gmt=10">GMT +10 Melbourne, Sydney, Canberra
<OPTION VALUE="index.php?gmt=11">GMT +11 Magadan, Solomon Island
<OPTION VALUE="index.php?gmt=12">GMT +12 Auckland, Wellington
</SELECT>
</FORM>
<?php

  
//set GMT +1 if param gmt is not enterd or invalid
  
if(!isset($_GET['gmt']) || !is_numeric($_GET['gmt']))
    
$gmt_x 1;
  elseif(isset(
$_GET['gmt']) && is_numeric($_GET['gmt']))
    
$gmt_x $_GET['gmt'];

  
//connect to site and read content
  
$program "http://www.eter.tv/arm/programs/print_version/a_Atvsput.shtml";
  
$content =  file_get_contents($program);

  
//replace local linked images by aboslute images
  
$content str_replace("/selectprogram/images/printer.gif""http://www.eter.tv/selectprogram/images/printer.gif"$content);
  
$content str_replace("/selectprogram/images/folder.gif""http://www.eter.tv/selectprogram/images/folder.gif"$content);

  
//adjust the time
  
function add_x_hours($match)
  {
    global 
$gmt_x;
    
$match[1] += $gmt_x 4//-4 to get GMT time
    
$match[1] %= 24//modulo 24 to avoid hours > 24
    
if($match[1] < 0)
      
$match[1] = 24 abs($match[1]);
    
$tijd $match[1].".".$match[2]; //melt hours with minutes
    
return $tijd;
  }
  
//regex pattern
  
$pattern "|(\d{2}).(\d{2})[ ](<\/font>)|";
  echo 
preg_replace_callback($pattern"add_x_hours"$content);
  
  echo 
"<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=1>
        <br />Time adjustments implented by <a href=\"mailto:drhendre@hotmail.com\">Henri Hambarsumyan</a></font>"
;
?>

</body>
</html>


Ik heb webspace genoeg, continu beschikbaar, laat maar weten wat je online moet hebben ;)

Enlightenment 06-05-2004 20:48

Als DJ Mark het wilt doen... :)

Mocht dat niet lukken, kan ik wel wat voor je regelen.

Marcus 06-05-2004 20:54

Ze staan inmiddels online (y)

Dr HenDre 06-05-2004 21:53

jep, maar 1 probleem

ik gebruik niet de latijnse alphabet maar voor de ene de cyrillische(russisch) en voor de andere de armeens.
Nu werkt de armeense wel goed, zowel op mijn bak als op dei van dj mark maar russisch werkt bij mij wel goed terwijl precies hetzelfde op zijn server gezet niet werkt. Rara hoe kan dit :|

Marcus 06-05-2004 23:05

Ik zal ze eens op een andere webserver zetten, die ook php ondersteunt. Misschien ligt het aan mijn host? Ik zet ze wel even online en dan zien we wel.

- edit -

Kijk hier eens, ze staan hier online op een andere webserver

Dr HenDre 07-05-2004 09:32

Citaat:

Dj Mark schreef op 07-05-2004 @ 00:05 :
Ik zal ze eens op een andere webserver zetten, die ook php ondersteunt. Misschien ligt het aan mijn host? Ik zet ze wel even online en dan zien we wel.

- edit -

Kijk hier eens, ze staan hier online op een andere webserver

uhu, dit ownt!!!!!!!!!!!!!

owww, wat ben ik je dankbaar *buigt* :cool: :cool:

Enlightenment 07-05-2004 15:08

Charming die blokjes in Firefox. ;)

Dr HenDre 07-05-2004 15:34

Citaat:

Enlightenment schreef op 07-05-2004 @ 16:08 :
Charming die blokjes in Firefox. ;)
mjuh, watch :cool:

http://members.lycos.nl/hendre/tv.jpg

Enlightenment 07-05-2004 15:51

Toch niet de agenda van een Armeense dutroux he? Ik word er niet veel wijzer van iig. :)

Dr HenDre 07-05-2004 16:14

Citaat:

Enlightenment schreef op 07-05-2004 @ 16:51 :
Toch niet de agenda van een Armeense dutroux he? Ik word er niet veel wijzer van iig. :)
neuh, tv programma's :p

Enlightenment 07-05-2004 16:22

Citaat:

Dr HenDre schreef op 07-05-2004 @ 17:14 :
neuh, tv programma's :p
Jaaaja, dutroux had ook allemaal 'tekenfilms' op z'n videobanden staan hè..

Marcus 07-05-2004 17:57

Citaat:

Dr HenDre schreef op 07-05-2004 @ 10:32 :
uhu, dit ownt!!!!!!!!!!!!!

owww, wat ben ik je dankbaar *buigt* :cool: :cool:

Goh wat ben ik weer aardig vandaag :p

Dr HenDre 07-05-2004 18:21

Citaat:

Enlightenment schreef op 07-05-2004 @ 17:22 :
Jaaaja, dutroux had ook allemaal 'tekenfilms' op z'n videobanden staan hè..
LOL, denk je echt dat dat zoiets is :p

Dr HenDre 07-05-2004 18:22

Citaat:

Dj Mark schreef op 07-05-2004 @ 18:57 :
Goh wat ben ik weer aardig vandaag :p
(y) (y) :cool: :cool:


Alle tijden zijn GMT +1. Het is nu 23:39.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.