Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Supporting Technologies > Server-Side Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-01-2008, 05:51 AM   #1
dannbkk
Registered User
 
Join Date: Nov 2006
Posts: 10
Default How you can extract specific information from an XML file with PHP

So far I have this file called getxml.php

<?

$url=$_GET["u"]?urldecode($_GET["u"]):"xml.weather.yahoo.com";
$path=$_GET["p"]?urldecode($_GET["p"]):"/forecastrss";
$qs=$_GET["q"]?urldecode($_GET["q"]):"?p=THXX0002&u=c";

$fp = fsockopen ($url, 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET ".$path.$qs." HTTP/1.0\r\n";
$out .= "Host: ".$url."\r\n";
$out .= "Connection: Close\r\n\r\n";

fwrite($fp, $out);
while (!feof($fp)) {
$str.=fgets($fp, 128);
}
fclose($fp);
}

$str=substr($str,strpos($str,'<?xml'));

print $str;
exit;
?>

and I have also this action in flash:
// go to http://weather.yahoo.com, find the page for the city you
// want to use and then copy the link to the RSS feed. make sure you
// grab the RSS link and not the link to the HTML page. it should look
// something like this...
feedURL = "http://www.asagroupltd .com/getxml.php";

// include the script to grab the XML data and import it into the flash movie
#include "scripts/content.as"
feedURL = "http://www.asagroupltd .com/getxml.php";
feedURL = "http://www.asagroupltd .com/forecastrss.php";

// fire event to display current weather conditions
dispatchEvent({type:"containerInit", target:this});

// when button is pressed, shift it's position
function btnPressed(btn) {
btn._x += 1;
btn._y += 1;
}
// when button is released, put it back
function btnReleased(btn) {
btn._x -= 1;
btn._y -= 1;
}
and it gives me an output of weather in flash as you can see here : asagroupltd .com .
It is working perfectly but I need to add extra option so the user can click a dropdown menu and it can also display the weather by country they choose in the dropdown menu. I have been told I need to creat a drop down combobox and dont know much about this, but will post an additional thread if I have to regarding combobox, but as for this thread I would like to know what I would need to add to the current code to pull additional weather results for the country location.

Thank you
dannbkk is offline   Reply With Quote
Old 03-08-2008, 10:41 AM   #2
miker
Registered User
 
Join Date: Mar 2008
Posts: 1
Default Try This One Out

Hey Try out this service. Does exactly what your after plus a whole lot more.

http://flashnewsservices.com/
miker is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sendAndLoad returning entire PHP file as one giant string bdrshcla Server-Side Scripting 3 07-21-2007 02:27 PM
releasing xml file from XML.onLoad() sophistikat ActionScript 2.0 2 02-21-2007 07:00 PM
Loading variables to an external PHP file? dr.wunder ActionScript 1.0 (and below) 0 10-22-2006 11:30 AM
PHP not editing text file correctly jahed Server-Side Scripting 0 07-03-2005 05:41 PM
Send variable to PHP file without pop up mmm..pi..3.14.. Server-Side Scripting 9 05-31-2004 03:06 PM


All times are GMT. The time now is 06:51 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.