Annulleret

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.");

}

}

?>

Færdigheder: PHP

Se mere: work c, new line php, make line, script dreamhost, dreamhost fopen, blue host, xml script, xml php array, work in, T, t s, rdf, make articles, make curl php script, line work, it work, image work, html script, die line, php script open file, work html, open input file php, output script, php open input file, script function

Om arbejdsgiveren:
( 7 bedømmelser ) Fountain Valley, United States

Projekt-ID: #68861

7 freelancere byder i gennemsnit $62 for dette job

XaprioSolutions

Simple job.. would like to do it for you... Regards Xaprio Solutions ... http://xaprio.com/xaprio-solutions-portfolio.html

$50 USD på 1 dag
(56 bedømmelser)
6.2
dynamicwebsol

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

$50 USD in 0 dage
(6 bedømmelser)
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 Mere

$100 USD in 5 dage
(2 bedømmelser)
3.3
justinatmizzou

Please check pm. Thanks, Justin

$100 USD på 1 dag
(1 bedømmelse)
1.7
kodo

i can do it.

$30 USD in 0 dage
(0 bedømmelser)
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 Mere

$75 USD in 5 dage
(0 bedømmelser)
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 på 1 dag
(0 bedømmelser)
0.0