From: Patel, A. <Aman.Patel@STJUDE.ORG> - 2006-08-10 14:54:30
|
Hello everyone, I've just installed Fez. It all worked fine... Until we tried to create a community. When I tried to create a community, a bunch of PHP errors showed all indicating that the loadXML function had failed at line 605 of include/class.fedora.api.php: <snip> $filename =3D APP_FEDORA_GET_URL."/".$pid."/".$dsID; $xml =3D Misc::processURL($filename); if ($getxml) { return $xml; } if (!empty($xml) && $xml !=3D false) { -> $doc =3D DOMDocument::loadXML($xml); $xpath =3D new DOMXPath($doc); $fieldNodeList =3D $xpath->query("/*/*"); foreach ($fieldNodeList as $fieldNode) { =09 $resultlist[$fieldNode->nodeName][] =3D trim($fieldNode->nodeValue); <snip> After prilimnary search. I found that the processURL function was getting a error page instead of a XML result. I checked by visiting $filename (url) myself, and fedora asked me for a username/password, which was expected. Then I checked the code for processURL. It basically used CURL to fetch the $filename url and return its content. But since fedora required the HTTP basic auth, it obviously failed with the "authorization" failed html message, instead of the xml output. So I changed processURL somewhat (to add the http basic auth). See code below: function processURL($url) { if (empty($url)) { return ""; } $url=3Dstr_replace('&','&',$url); $ch=3Dcurl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); -> curl_setopt ($ch, CURLOPT_USERPWD, APP_FEDORA_USERNAME.":".APP_FEDORA_PWD); -> curl_setopt ($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); $data =3D curl_exec ($ch); curl_close ($ch); return $data; =20 } Just added those two lines as indicated. After I did this, it all worked! I was able to create a community and all was fine. My question to you is this: Is this code change normal? I obviously have no idea in the grand scheme of things how this will affect the rest of the code. I'd appreciate any insight! Thanks a lot! - Aman Patel, Sys Admin / Database / Web Developer, International Outreach x4076=20 |