Cancelado

Make this script work in DreamHost(Doesn't allow fopen)

My host, dreamhost doesn't allow the usage of fopen, so it probably requires CURL to make this script work, please make it work in dreamhost!

<?php

set_time_limit(0);

$file = "[url removed, login to view];ned=us&ie=UTF-8&q=blue+shoes&output=rss";

$rss_channel = array();

$currently_writing = "";

$main = "";

$item_counter = 0;

function startElement($parser, $name, $attrs) {

global $rss_channel, $currently_writing, $main;

switch($name) {

case "RSS":

case "RDF:RDF":

case "ITEMS":

$currently_writing = "";

break;

case "CHANNEL":

$main = "CHANNEL";

break;

case "IMAGE":

$main = "IMAGE";

$rss_channel["IMAGE"] = array();

break;

case "ITEM":

$main = "ITEMS";

break;

default:

$currently_writing = $name;

break;

}

}

function endElement($parser, $name) {

global $rss_channel, $currently_writing, $item_counter;

$currently_writing = "";

if ($name == "ITEM") {

$item_counter++;

}

}

function characterData($parser, $data) {

global $rss_channel, $currently_writing, $main, $item_counter;

if ($currently_writing != "") {

switch($main) {

case "CHANNEL":

if (isset($rss_channel[$currently_writing])) {

$rss_channel[$currently_writing] .= $data;

} else {

$rss_channel[$currently_writing] = $data;

}

break;

case "IMAGE":

if (isset($rss_channel[$main][$currently_writing])) {

$rss_channel[$main][$currently_writing] .= $data;

} else {

$rss_channel[$main][$currently_writing] = $data;

}

break;

case "ITEMS":

if (isset($rss_channel[$main][$item_counter][$currently_writing])) {

$rss_channel[$main][$item_counter][$currently_writing] .= $data;

} else {

$rss_channel[$main][$item_counter][$currently_writing] = $data;

}

break;

}

}

}

$xml_parser = xml_parser_create();

xml_set_element_handler($xml_parser, "startElement", "endElement");

xml_set_character_data_handler($xml_parser, "characterData");

if (!($fp = fopen($file, "r"))) {

die("could not open XML input");

}

while ($data = fread($fp, 4096)) {

if (!xml_parse($xml_parser, $data, feof($fp))) {

die(sprintf("XML error: %s at line %d",

xml_error_string(xml_get_error_code($xml_parser)),

xml_get_current_line_number($xml_parser)));

}

}

xml_parser_free($xml_parser);

// output HTML

//print ("" . $rss_channel["TITLE"] . "");

if (isset($rss_channel["ITEMS"])) {

if (count($rss_channel["ITEMS"]) > 0) {

// for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {

for($i = 0;$i < 5;$i++) {

if (isset($rss_channel["ITEMS"][$i]["LINK"])) {

//print ("n" . $rss_channel["ITEMS"][$i]["TITLE"] . "");

} else {

print ("n" . $rss_channel["ITEMS"][$i]["TITLE"] . "");

}

print ("" . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . ""); }

} else {

print ("There are no new articles.");

}

}

?>

This might help:
http://wiki.dreamhost.com/index.php/CURL
http://wiki.dreamhost.com/index.php/Allow_url_fopen

budget is $25 max

Habilidades: PHP

Veja mais: work com, work c, new line in php, make line, make $5, com work, break com, at & t, at &t, script dreamhost, dreamhost fopen, work.com, work in google, blue host, xml script, xml php array, Work, work in, t , t-, t, t s, rdf, news-r, make

Acerca do Empregador:
( 7 comentários ) Fountain Valley, United States

ID do Projeto: #68861

7 freelancers estão ofertando em média $62 para esse trabalho

XaprioSolutions

Simple job.. would like to do it for you... Regards Xaprio Solutions ... [login to view URL]

$50 USD em 1 dia
(56 Comentários)
6.2
dynamicwebsol

Can make this script work. Can I do it now ?

$50 USD in 0 dias
(6 Comentários)
3.8
varshyltech

We at Varshyl Tech - an ITES helps businesses in their software, database design, website development and other related vertical needs with primary focus on Website Design and Development, Application Development, Cust Mais

$100 USD in 5 dias
(2 Comentários)
3.3
justinatmizzou

Please check pm. Thanks, Justin

$100 USD em 1 dia
(1 Comentário)
1.7
kodo

i can do it.

$30 USD in 0 dias
(0 Comentários)
0.0
IntSS

GOOD QUALITY WORK WITH INTIME DELIVERY OF THE PRODUCT . 100% GUARANTEED OF HIGH QUALITY PROFESSIONAL WORK, AS WE ARE THE EXPERTISE IN JAVA/J2EE , JSP , EJB, ASP,PHP, STRUTS FRAME WORK RELATED PROJECTS. OUR COMPANY HAS Mais

$75 USD in 5 dias
(0 Comentários)
0.0
lraek

I have used CURL to Login to restricted sites compare data and post the difference back to the site. No problem at all to fix.

$30 USD em 1 dia
(0 Comentários)
0.0