replacement fopen - fsockopen - quick n dirty hack

replacement fopen - fsockopen - quick n dirty hack - PHP - Programmation

Marsh Posté le 06-06-2005 à 19:28:18    


 
 
g ´day  all here,  
 
 
i traveled alot for examples and descriptions about the amazon web services. i came across many many sites for Amazon scripts that are easy.  
 
i want to show on my homepage a number of 40 books. i am not a experienced php programmer - i am able to understand a bit of php but i am new to it. i had a look at a site with some nice scripts for Amazon web services.  
 
http://www.chipdir.nl/amazon/
 
This site offers great insights into the AWS-technology.  
 
But my server is limited to some restricted settings: i have no allow_url_fopen - to say it in other words my serverconfiguration option allow_url_fopen is set to OFF!
 
i only can make usage of fsockopen - so i only can make usage of scripts that work around the issues.
 
i want to run a site with a phpnuke. There is a great module that uses amazon web services - see http://preciogasolina.com/nukeamazon.html
 
but this script makes usage of the fopen. well i need a work around for this.  
 
just another question - regarding another amazon script - here a PHP-Nuke module, called NukeAmazion:  
 
the NukeAmazon, a phpnuke-module - makes usage of the fopen-function. it is a great and most wanted module. Since the mod runs in many many sites - and probably could run in much much more sites - somebody should replace the fopen with a method that is more appropiate here - your fsockopen. could you provide us with some guidlelines - how to replace the fopen with a better solution.  
 
Well - here is the stuff.  
 
http://preciogasolina.com/nukeamazon.html
 
see a thread of a user who complains the bad situation - and suggestes Curl as a solution
 
http://www.preciogasolina.com/modu [...] opic&t=344
 
here is the stuff  
http://www.preciogasolina.com/modu [...] load&cid=1
 
well - the replacement should be only in one place - in the functions-file called functions.php : This file can be found in the includes-directory. the structure is the following:  
 
http://www.preciogasolina.com
 
 
/admin
/blocks
/images
/includes/ functions.php
/modules
 
well - the only place where we can find fopen () function is here in the file  
 
in the functions.php (which is in the includes-folder)
 

Code :
  1. function AMZ_file_get_contents($filename)
  2. {
  3. $fp = @fopen($filename, "r" );
  4. if (!($fp))
  5. {
  6. return 0;
  7. }
  8. while (!feof($fp))
  9. {
  10. $temp .= utf8_decode(fread($fp, 4096));
  11. }
  12. fclose($fp);
  13. return $temp;
  14. }


 
that would be great. I try to do it on my own - and if you have some hints - how to patch then plz. let us know.  
 
BTW; after this is done i will to patch the amazon-module
of this site. - also a great site; A standalone-script which is very very nice. http://www.accessories.me.uk a great script.... see it running.  Well if you could guide us here it would be very nice.  
 
 
if anybody could give some hints - if anybody could provide some advices and guidings then i would be very glad. You would make some most wanted script even more appropiate - and useable in real world scenarios. Since many many servers do not provide a fopen (), we could - should work around this serious bottlenneck.  
What do you think
 
look forward to hear a answer
 
 
 
many greetings  

Reply

Marsh Posté le 06-06-2005 à 19:28:18   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed