Posted: Tue Apr 26, 2005 5:24 pm Post subject: fopen is disabled so module doesn't work
My host has disabled PHP's allow_url_fopen which includes the "fopen" command for security reasons which doesn't allow this module to work. They instead recommend curl functions.
$curl_handle = curl_init();
// Where should we get the data?
curl_setopt ($curl_handle, CURLOPT_URL, ‘http://example.com’);
// This says not to dump it directly to the output stream, but instead
// have it return as a string.
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
// the following is optional, but you should consider setting it
// anyway. It prevents your page from hanging if the remote site is
// down.
curl_setopt ($curl_handle, CURLOPT_CONNECTTIMEOUT, 1);
// Now, YOU make the call.
$buffer = curl_exec($curl_handle);
// And tell it to shut down (when your done. You can always make more
// calls if you want.)
curl_close($curl_handle);
// This is where i’d probably do some extra checks on what i just got.
// Paranoia pays dividends.
print $buffer;
Posted: Tue Aug 23, 2005 11:31 am Post subject: Does not work.
There is no function AMZ_file_get_contents($url) in functions.php.
Only reference to fopen is code below:
Code:
function AMZ_file_get_contents($filename)
{
$fp = @open($filename, "r");
if (!($fp))
{
return 0;
}
while (!feof($fp))
{
$temp .= utf8_decode(fread($fp, 4096));
}
fclose($fp);
return $temp;
}
Only reference to AMZ_file_get_contents($url) is found just above that in functions.php:
Code:
$String = AMZ_file_get_contents($URL);
Need a version that uses curl when fopen is off. I have been waiting over a year for a solution! I'm about ready to remove module. It has been broken since admin disabled fopen. Is anyone working on this?!
With fopen() disabled (which it should be), using the curl method to grab XML works great. Unfortunately, the "getImageSize" function gets disabled where the code does "getImageSize($url)" ... and we end up with no thumbnails.
Posted: Fri Nov 11, 2005 8:35 pm Post subject: re: no thumbnails
Image problem solved!
Did a little digging and came up with a workaround for image display problem. Did a search of code in includes/NukeAmazon/functions.php and made the following changes. Images now displaying for products.
Worked for me in combination with curl option since fopen was disabled. getImageSize function still works for the most part, just not in fetching product images as $ImageUrl.
Must use $arr['imageurlsmall'] and $arr['imageurlmedium'] instead. Only had to make the 3 changes below in functions.php to get it working on my server.
---------------------
Do a search and replace to fix code. FYI- I'm using NukeAmazon 2.7
small images fix:
(for May we suggest ... & related products, etc...)
hmmm ... I'm using 2.7.2, and my line numbers don't anywhere near correspond with yours ---- I mean like, 1000 lines off. And, I'm still getting "Image Not Available" due to the Product Image bits checking "GetImageSize($url)" ...
I was able to get it to work, though not the best way, but simply commenting out the rather hefty Conditional in a couple of places ...
Then it works with fopen disabled --- an easy fix, that's easy to see. But who knows if I'm breaking something else... But ... at the same time, it's not likely you're going to end up with an image in their XML that's LESS than 2x2, so the issue is kinda moot.
The thing that'll actually fix it ... is to use curl to download the thumbnails to a cache, and do the GetImageSize against the local file. fopen's just too dangerous to leave turn on, especially with PHP-Nuke.
Posted: Sat Nov 12, 2005 1:22 pm Post subject: re: GetImageSize
Oops!
I forgot about that last part.
In functions.php I added a @ before all getimagesize so php doesn't broadcast it. (@getimagesize)
I'll try to find a "real fix" that works with curl, but for now at least I have images. I agree that using curl to write images to a /temp directory and then accessing it locally rather than by url is the real ticket.
Guess I have to dig a little deeper and see what I can come up with. I'll let you know if I come up with a fix...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum