PHP problems

software development

#1

I installed a RSS plugin for Wordpress, but i get this error when I try to run it.

Reading http://www.tuaw.com/rss.xml - 1

Warning: file() [function.file]: URL file-access is disabled in the server configuration in /home/.xxxx/xxxxx/xxxxxx.com/xxxxx.php on line 29

Warning: file(http://www.tuaw.com/rss.xml) [function.file]: failed to open stream: no suitable wrapper could be found in /home/.xxxx/xxxxx/xxxxxx.com/xxxxx.php on line 29

Warning: implode() [function.implode]: Bad arguments. in /home/.xxxx/xxxxx/xxxxxx.com/xxxxx.php on line 29

Here is line 29 from the PHP file

$data = implode("", file($filename));

Are Dreamhost blocking it somehow or do I need to set permissions somewhere? I’m sure it’s really simple, so If you know a solution, I will be very greatful!!

Cheers


#2

This is probably one of the most-asked questions on this forum now. I’ve yet to find a single piece of forum software that does not include some form of search facility.

That being said, the information you need can be found on the DreamHost wiki.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

Thanks Simon

I did try to search the forum and Wiki, but if you don’t know what to look for, it’s hard to find.

I’m a complete noob in this, and have no idea where to begin. How much would it cost me to get you to do it? I’ll rather spend some cash on it, instead of spend endless hours trying to learn howto.

Cheers


#4

Replace that line with the following:$ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $filename); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); $data = implode("", $file_contents);Let me know if it works.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#5

Well, it seems to partly work, but it still give me this

Warning: implode() [function.implode]: Bad arguments.

Here is the hole section from the php file (including the part you gave me)

// read the XML database of aminoacids
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $filename);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
$data = implode("", $file_contents);
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $tags);
xml_parser_free($parser);

And thank you so much for helping me out, really appreciate it. If I get this working, I’ll send a nice PP donation your way for sure.


#6

[quote]Well, it seems to partly work, but it still give me this
Warning: implode() [function.implode]: Bad arguments.[/quote]
That’s my fault for not being all that familiar with file system functions. We are trying to feed the implode() function with a string, but it is in fact expecting an array (which was originally created by the file() function). This should do the trick:

$ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $filename); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); $lines = array(); $lines = explode("\n", $file_contents); $data = implode("", $lines); $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $data, $values, $tags); xml_parser_free($parser);Once again, let me know if it works.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#7

HI! OUR page (http://popsops.com/keyhole.php) don’t working!
We wrote about this in support, and here is that they have answered:

////////////The problem is with the above
"include(http://nagval.ru/include/pages.php…)" part. This is because
it is a big security risk and causes more server load and traffic to
include a file from another web server. If you really must have this
functionality, please try switching it to use the cURL functions instead.
These are documented here:http://wiki.dreamhost.com/index.php/CURL////////

Help us to do such code, which was worker on this hostinge. we not programmers, tried themselves - a page don’t care does not work!
Do Not know what understand with this code:

<?php // Lnks.ru code $url = "http://" . $HTTP_SERVER_VARS['HTTP_HOST'] . $HTTP_SERVER_VARS['REQUEST_URI']; ini_set('error_reporting','E_ERROR'); include("http://www.lnks.ru/include/?u=188&siteID=119&mpp=20&url=".urlencode($url)."&page=$page&cat=$cat&ua=".urlencode($HTTP_SERVER_VARS['HTTP_USER_AGENT'])); // end Lnks.ru code ?>

Help at earliest convenience! Thank you!