Skip to main content
Known Participant
July 13, 2007
Answered

error in xslt transformation

  • July 13, 2007
  • 17 replies
  • 2770 views
hi
i make xsl fragment from rss feed and it shows the data perfectly when testing xsl file .

i make php page and go to application panel and make xslt transformation and when click ok it gives me message

the page appears with the &nsap and np blah blah ,,,,,,,,
ant at the top of the page says "MM_XSLTransform error."

so what to do ? i want to show what i have transformed in my php page how?

thanks in advance.
This topic has been closed for replies.
Correct answer Newsgroup_User
macnux wrote:
> you can take alook at server info i made it in order to see it
> actualy xsl is supported and every thing is good here

Yes, XSL is definitely supported. Your problem is that allow_url_fopen
is turned off. This prevents the XSL Transformation server behavior from
accessing the RSS feed. Unfortunately, there's nothing you can do about
this unless you can persuade your hosting company to turn
allow_url_fopen on. The good news is that your server uses PHP 5.2.3,
which has the following separate directives and settings:

allow_url_fopen Off
allow_url_include Off

Hosting companies typically turn off allow_url_fopen to prevent sites
from including material from other servers, which can be a security
risk. In PHP 5.2, allow_url_fopen no longer allows files to be included
directly into a script. The new directive allow_url_include now controls
remote includes.

What you need to persuade your hosting company is to use these settings:

allow_url_fopen On
allow_url_include Off

This would allow you to pass RSS feeds to the XSL Transformation server
behavior, but prevent the security risk of including a remote file
directly inside your script. However, it might be difficult to persuade
a support person to alter the company's policy, even though this change
is designed to make PHP much safer to use.

If you can't get the hosting company to change its policy, submit a
feature request to Adobe, asking them to improve the server behavior so
that it uses a socket connection or cURL.

http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

Socket or cURL connections get around the problem of allow_url_fopen
being turned off, but they're not supported by the XSL Transformation
server behavior.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

17 replies

Inspiring
September 21, 2007
DEPearson wrote:
> My to do list:
> 1. find a function that will check if allow_url_fopen is set to off.

if (!ini_get('allow_url_fopen')) {
// code to run when allow_url_fopen is off
}

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
September 21, 2007
My work around for the "MM_XSLTransform error on Servers with allow_url_fopen set Off. I modified the function getRemoteFile() in MM_XSLTransform class version 0.6.2 around line 162. I removed the if statement at line 173.
Here is my temp fix. Please note this is not complete, just playing with it; not sure of any side effects yet.
My to do list:
1. find a function that will check if allow_url_fopen is set to off.
2. Set up a if or case statement to select the use fopen option or the cURL option depending on the value return by step one.
3. Add some error checking, and figure out a good timeout time.

Does anybody see any security problems with the code below.

Thanks
David Pearson

function getRemoteFile(&$src) {
$fileContent = '';

$pos = strpos($src, '://');
$protocol = strtolower(substr($src, 0, $pos));

// avoid protocol upper case
$mySrc = $protocol . substr($src, $pos);

$magic_quotes_runtime_orig = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);

$ch = curl_init();
$timeout = 0; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $mySrc);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$fileContent = curl_exec($ch);
curl_close($ch);

if ($protocol == 'https') {
$this->setError($this->getErrorFromCode('MM_HTTPS_OPEN_ERROR', array($src)));
if ( (substr(PHP_VERSION, 0, 1) < 5) && (substr(PHP_VERSION, 2, 1) < 3) ) {
$this->setError($this->getErrorFromCode('MM_HTTPS_NOT_SUPPORTED_ERROR', array($src)));
}
}

set_magic_quotes_runtime($magic_quotes_runtime_orig);

return $fileContent;
}
Participant
November 1, 2007
Bless you, DEPearson. I've been looking for this fix all day. Works great for me.
Participant
January 28, 2008
The fix totally works! Yeay DEPearson and David Powers. I used Powers's book Essential Guide to Dreamweaver CS3 to create the XSL fragment for my company's website in order to pull in the feed from our Typepad blog. But because the Typepad blog was on a different server from the home page (which was hosted on Dreamhost); and because the allow_url_fopen was turned Off, it wasn't working. Using this code fixed it.

For people like me though, who are still in the copy and paste level of code writing, I wanted to share how I combined Powers and DEPearson's code, which starts on line 171:
Newsgroup_UserCorrect answer
Inspiring
July 19, 2007
macnux wrote:
> you can take alook at server info i made it in order to see it
> actualy xsl is supported and every thing is good here

Yes, XSL is definitely supported. Your problem is that allow_url_fopen
is turned off. This prevents the XSL Transformation server behavior from
accessing the RSS feed. Unfortunately, there's nothing you can do about
this unless you can persuade your hosting company to turn
allow_url_fopen on. The good news is that your server uses PHP 5.2.3,
which has the following separate directives and settings:

allow_url_fopen Off
allow_url_include Off

Hosting companies typically turn off allow_url_fopen to prevent sites
from including material from other servers, which can be a security
risk. In PHP 5.2, allow_url_fopen no longer allows files to be included
directly into a script. The new directive allow_url_include now controls
remote includes.

What you need to persuade your hosting company is to use these settings:

allow_url_fopen On
allow_url_include Off

This would allow you to pass RSS feeds to the XSL Transformation server
behavior, but prevent the security risk of including a remote file
directly inside your script. However, it might be difficult to persuade
a support person to alter the company's policy, even though this change
is designed to make PHP much safer to use.

If you can't get the hosting company to change its policy, submit a
feature request to Adobe, asking them to improve the server behavior so
that it uses a socket connection or cURL.

http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

Socket or cURL connections get around the problem of allow_url_fopen
being turned off, but they're not supported by the XSL Transformation
server behavior.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
macnuxAuthor
Known Participant
July 19, 2007
you can take alook at server info i made it in order to see it
actualy xsl is supported and every thing is good here and php version is 5.2.3

http://mokhtar.phpnet.us/info.php

thanks in advance.
Inspiring
July 19, 2007
macnux wrote:
> i works in my local server but on remote server still !!! why?

Does your remote server support XSL? The XSL Transformation server
behavior works automatically detects whether your server is running PHP
4 or PHP 5, because they use different PHP functions.

On a PHP 4 server, the XSLT extension and the sablotron library must be
enabled. These are not normally installed by default, as sablotron is
separate from PHP.

On PHP 5, you need the XSL extension. Even if it isn't enabled, most
hosting companies should be able to turn it on easily, because it's a
core part of PHP 5.

Run phpinfo() to see whether your remote server has the necessary
functionality.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
macnuxAuthor
Known Participant
July 19, 2007
thanks for reply

i works in my local server but on remote server still !!! why?
http://mokhtar.phpnet.us/
Inspiring
July 18, 2007
macnux wrote:
> the link don't mention the solution just gave the problem .

There is a link to the fix in the second sentence of that page. Since
you couldn't find it, here's a direct link:

http://kb.adobe.com/support/dreamweaver/ts/documents/b6c2ae2a/DW802_HotFix-0_6_0.zip

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
macnuxAuthor
Known Participant
July 18, 2007
the link don't mention the solution just gave the problem .

and i try remote server also the same problem
check it here
http://mokhtar.phpnet.us/
Inspiring
July 18, 2007
macnux wrote:
> what is the PHP hotfix extension?where i can get it?

I gave you the link in my previous post:

http://www.adobe.com/go/b6c2ae2a

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
macnuxAuthor
Known Participant
July 18, 2007
im using DW 8 and im installing the updater 8.0.2

what is the PHP hotfix extension?where i can get it?

by the way i found my problem at this page but can't find the proper answer
http://kb.adobe.com/selfservice/viewContent.do?externalId=b6c2ae2a&sliceId=2#xsl