Feed Included URL Into A Variable.
I need to access a page (CGI) on a different server. I can do this fine with an include and that will display all the info I need on the screen.
The problem I face is that I actually need to parse through that info. When i try assigning it to a variable...
$dogggg = include ("$SpecialString");...the variable is always "1".
$specialString is the URL
Clearly what I am doing is wrong but if someone can please point me in the right direction for what I need to do in order to get that output into a variable so that I can parse it, do what I need to with that info and then display it.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Variable Scope Of Files Included Within Functions
I have a function that selects a file to include, then includes is. The file is including within the function, like so: function include_file($file_name) { [lots of logic here to figure out the path...] require $file_name; return; } My problem is that the file gets included *within* the function, so all the code in the file inherits the function's scope. Any variables declared in the include file are not global -- they're local to that function. Is there any way around this? Is there anything I can put in the included file or in the function to make sure that variables declared within it are global? (I can't just reference the variables before the require, because I have no way of knowing what's in the include file.)
RSS Feed Creator - Not Valid RSS Feed?
i've been working on a script that would generate an RSS feed, and that seems to work, it displays the feed in FireFox the way it should, but when i try to link to it as a live bookmark or aggregate it in thunderbird, it claims it to not be a valid feed. here's the feed: Code:
Problem With A File Included Twice When I Want It To Be Included Once
I have a problem with a file that apparently is being included twice when I want it to be included once. I searched all my files and couldn’t find a place in which I am not calling it with include_once("file_name") Is there a way to print or output in any way which file calls this file? It could be an included file that calls this file, so I need to know the file name, not the page name that calls this file.
Included File Not Included Every Time
I have some pages where I'm including a header for the document - beginning of the HTML, style sheet, javascript, logos etc. The problem is that sometimes it's being included and sometimes it isn't - and I'm talking even on the same page. The header file is in the same folder as the document I'm including it in, so I'm just using: PHP Code:
Value Of Variable Shown As "Array" When From Included File
I have this statement to find the latest date that a row was inserted ________ $entry=mysql_query("SELECT contact FROM board ORDER BY contact DESC LIMIT 1")or die ("Query failed:<br>$entry<br>Error: " . mysql_error()); while($myrow=mysql_fetch_array($entry)){ if (ISSET($myrow['contact'])){ $latest = date("d M y", ($myrow['contact']+50400)); } } ________ This reports the value for $latest correctly if the statement is in the document. However when the statement is in an included file the reported value for $latest is ... Array Where am I going wrong?
Is A PHP Variable Supposed To Be Seen In A .js File Included Into A .php File
Is a PHP variable supposed to be seen in a .js file included into a .php file? I have a client side javascript code stored in a .js file which is included into a PHP file using <script src="filename.js></script> This code initialises a Javascript variable var u="string"; The string is supposed to be the value of $HTTP_HOST So, when initialise this variable like var u=<? echo $HTTP_HOST;?>; I sterted getting a javascript message Syntax Error Am I doing something wrong, or PHP variables are not seen in included js files?
Rss Feed
i want some info about how i can put the bbc news,cnn news on my page.is there any opensource rss feed system,so that i can get the news and store it in mysql db and display the news.any of your help will be surely appreciated.
PHP FEED?
I have to design a job portal website - that will allow others to upload data to it (at the same time they upload to their own website) How can this be done? Basically they only have to upload the data (job placements) once - just to their website but it gets written to my db too?
Xml News Feed
if you are reading in a xml newsfeed in php, whats the best way to put a timer on how often you update your newsfeed?
Help: Escaping An RSS (XML) Feed Using PHP?
I've created an RSS 2.0 Feed for a friend of mine using PHP and MySQL. The author writes a ton of articles. I've worked out all the details of creating the feed in PHP, except for escaping characters for XML/RSS. What's the best way to escape Text/HTML for an RSS 2.0 Feed using PHP? Can RSS descriptions contain HTML? And... How might I escape out those "Mikrsooft" characters that I know the author will copy into the RSS descriptions?
Creating XML Feed Using PHP
I am trying to create an xml-feed using php (without any classes). So I wrote a php script that fetches data from a mySQL db and displays that in xml-format. So far no problem. But then there occured the first problem. I used that code: PHP Code:
Opening RSS Feed
I'm trying to open an RSS feed. I tried fopen, ran into problems, then found that the solution was a security risk. This had to do with changing PHP defaults on opening files. fsockopen() seemed to be the answer. I was able to get a test case to work. But I'm having problems with the one I really want to use. I'm using an RSS parser, LastRSS, and found a version of it that uses fsockopen instead of fopen. Code:
Dynamic RSS Feed Using PHP
I am building an RSS feed for my site that is going to use the database entries to populate the latest 15 entries on the RSS feed. Its been completed and works fine, except two problems. #1. The description field which is a text field with unlimited characters outputs in pull. I would like to limit this to 200 CHAR. Is there a command I can use to limit the field description from outputting the full article to only allow an output of 200 words? #2. Whenever there is an apostrophe s (') it displays it in the RSS feed as a triangle like it does not recognize the character. Does anyone have an idea of how I can get the feed to pull database entries with the ' and not have them displayed as triangles with question marks? Code:
Modifying XML Feed
Im trying to modify an XML Feed, created by Yahoo Stores (why I cannot just modify the xml generator code) to exclude some content.. Code:
RSS Feed Into MySQL (using Php)
I want to save everything that is coming off of a RSS feed into a MySQL database, so I can run reports and analysis later... What/how do I use/do this?
RSS Feed - XML Error
i was trying to parse an RSS feed, but it always shows an error XML error. The rss url is "http://kuwaitse.com/PORTAL/A/RSS/". I used so many rss parsers, but all shows the error XML error.
Rss Feed From A Php Page?
How can I turn the contents of a standard php page that changes every 3 days to an rss feed please?
XML Data Feed
I have a really old script I have been using for weather from weather.com. It get's the weather and shows it on my homepage. A few weeks ago it randomly stopped working. I renewed my account with weather.com and I still can't get it to work. It seems to be getting stuck on the line of code below. Code:
News Feed
i was just wondering the best way to go about making part of a page a "News Feed". I need it so that someone can log in to a page (i already have done this part), and then type into a text box and upload the content typed to a page. I was thinking of combining html's <form> tag with text box and then using some php to upload that to the homepage.
Problems Parsing Xml Feed
I'm using php to sift through some RSS feeds & store the information into my database. The problem is, it has some trouble dealing with certain characters. Here is an example of a URL that I'm trying to retrieve. http://path/file.php?param1=something¶m2=somethingelse Nothing special... huh? Well when I just display the character data from this field it comes out like this... http://path/file.php?param1=something¶m2=somethingelse & when I store the character data into an array, it only takes the part AFTER the &. Any idea how I can fix this? & does anybody know of any other characters that may cause problems like this?
Include PHP Feed From Other Domain
A partner is suggesting I iframe their php-feed (http://www.partner.com/partner/feed.php) in an HTML page on my website. I do not want to use this option because the varying page length of the feed causes all kinds of usability issues. I tried SSI but this can apparently only include files already in the same root as my HTML page. Here the feed page is coming from another domain. What other options do I have to seemlessly incorporate their PHP-feed?
RSS Feed Parsing With Limit
I've set up a news links section using the RSS parsing tutorial found Everything works great but depending on the feed source there may be 3 news links or 30. How can I limit the amount of titles, descriptions, and links output to be no more than 10? [MY SLIGHTLY MODIFIED CODE PASTED BELOW] <dl> <?php $insideitem = false; $tag = ""; $title = ""; $description = ""; $link = ""; $feedurl="http://rss.news.yahoo.com/rss/business"; function startElement($parser, $name, $attrs) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { $tag = $name; } elseif ($name == "ITEM") { $insideitem = true; } } function endElement($parser, $name) { global $insideitem, $tag, $title, $description, $link; if ($name == "ITEM") { $description=str_replace("'","",$description); //take out ' characters that were causing probs with tooltip javascript printf("<dt><a href='%s' target='mtgnews' onmouseover="return overlib('%s')" onmouseout="return nd();">%s</a></dt>", trim($link),htmlspecialchars(trim($description)),h tmlspecialchars(trim($title))); $title = ""; $description = ""; $link = ""; $insideitem = false; } } function characterData($parser, $data) { global $insideitem, $tag, $title, $description, $link; if ($insideitem) { switch ($tag) { case "TITLE": $title .= $data; break; case "DESCRIPTION": $description .= $data; break; case "LINK": $link .= $data; break; } } } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen($feedurl,"r") or die("Business News Unavailable."); while ($data = fread($fp, 4096)) xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); fclose($fp); xml_parser_free($xml_parser); ?> </dl>
XML Feed From Mysql Database With PHP
I'm finding myself with the task of writing a php script to automatically compile an XML feed with some standard tags and some tags with data taken from a MySql database.
PHP Output Of RSS Feed Not Validating..
I am outputting RSS feed with a PHP script, but some of the dates/times are causing the feed to fail w3 validation (see: here). What is causing the problem?
RSS NEWS FEED ON WEBSITE
I'm looking for a free (yes FREE) RSS feed for news on one of my websites. I'm currently using newsgator but have been told that if I want to edit the style of links that I've got scrolling for news at the BBC feed it's going to cost me a minimum of $500 per annum - whatever happened to 'freedom of speech'!? All i want to do is reduce the size of the text and change a few colours, but as the java links to a style sheet on the newsgator server I either have to pay-up or stick with 'nursery size' fonts! Any one know a url where I can can a news feed with basic (fonts, sizes, colour) editing tools?
Why Is /php/php.exe/ Included In Url When Using $PHP_SELF?
For some reason when I run $PHP_SELF in a script the url it returns includes /php/php.exe/ between the root folder and the actual php file from which $PHP_SELF originated. how to get rid of this so it shows the normal directory structure?
News Feed On A Static Site
I need to provide the news feeds on a static site, i was just thinking how to do so, any pointers, the feeds will be like the latest news to be changed every week, And perhaps will be on the home page only.
Parsing XML Feed Without File Functions
I've written a php script to parse a remote XML file. This works fine on my test server however, the chap I've written the script for is using a hosting service which has disabled the file functions. Is there any way of parsing the xml file without access to the File or Curl functions? Script is below: if (!($fp=@fopen("http://server/xmlfeed.xml", "r"))) die ("Couldn't open XML."); $count=0; $element=array(); $state='' function startElementHandler ($parser,$name,$attrib){ global $count; global $element; global $state; switch ($name) { case $name=="SELECTION" : { $element[$count]["child1"] = $attrib["child1"]; $element[$count]["child2"] = $attrib["child2"]; $element[$count]["child3"] = $attrib["child3"]; $element[$count]["child4"] = $attrib["child4"]; $element[$count]["child5"] = $attrib["child5"]; break; } default : {$state=$name;break;} } } function endElementHandler ($parser,$name){ global $count; global $element; if($name=="SELECTION") {$count++;} } function characterDataHandler ($parser, $data) { global $count; global $element; } if (!($xml_parser = xml_parser_create())) die("Couldn't create parser."); xml_set_element_handler( $xml_parser, "startElementHandler", "endElementHandler"); xml_set_character_data_handler( $xml_parser, "characterDataHandler"); while( $data = fread($fp, 4096)){ if(!xml_parse($xml_parser, $data, feof($fp))) { break;} } xml_parser_free($xml_parser);
Extract And Display Amazon.com Xml Feed
I was wondering if anyone could demonstrate using php to extract and display an Amazon xml feed. Lets say the following one: http://xml.amazon.com/onca/xml2?t=w...te&page=1&f=xml Something very simple will do, such as extracting the first image and link within the file and outputting it. I'm just learning php and xml, and am having heeps of trouble getting my code to work (using php DOM).
XML Feed Dying, How To Handle Gracefully
I currently have an XML feed that is dying, I am assuming because the site it's coming from is down. Anyway, I have an error statement that executes when it can't be open for reading, but how would I do error checking, that would ignore the error and display an alternative should the feed fail? PHP Code:
Magpie RSS Rejects PHP Generated RSS Feed
Can any see why Magpie RSS won't accept this RSS Feed (that is valid according to the Feed Validator website). This is the code that generates it. A SQL query is run first into $result and then:
Data Feed Script Problems.
I have been having problems with this script: [code] .... The data isn't going into the table on my database. All the names are right and the script says that every thing was successful but when I check to see if there is any data in the table there is none. Please help me, I don't know what to do.
Partial Ot ... Stock Market Feed
I'm looking to add a page to my site where I can get stock quotes for the wired, but more importantly, the wireless web(ie my cell phone). I know how write the needed php and WAP application, I just don't know where to get the stock market feed, at least not without parsing a finance.yahoo.com page. Or something else like it that could change at any time. I'm looking for just the raw data feed. Anyone ever had to do this and can give me some info on a feed?
RSS Feed For World Time Zones
I am working on different country projects, where the delivery time of the project will be saved on their respective country timings.We need to display the time in IST time zone accordingly. I need to calculate the time difference between different india and other countries. For that is there any RSS live feed available to get the time difference between two countries. (dynamic values of the time difference according to the countries).
How Do I Carriage Return And Line Feed This?
I have a texts contents inside a file, which look like this below, Quote203.87.194.210 203.87.194.210 203.87.194.210 203.87.194.210 203.87.194.210 what i want from this texts contents from a file is to print it on a web page just like what you see above. I tried to use file_get_contents(); but the result is like this below, Quote203.87.194.210203.87.194.210203.87.194.210203.87.194.210203.87.194.210 what i really want to figure out is how to put CR/LF so that it will show the same format or original format on the page.
Same Variables Used In 2 Included Files
I have 2 seperete files I am including into a script. They uses the same verriables however I want one to execute and then the other. will this be a problem?
Change Included Code
Can I modify code that I have included using <?php include("../Index.php"); ?> The Index.php file contains links that need to be modified to work. Index.php is basically an html file uses a linked css file and when its included in the new file its referencing a css file in the wrong spot. I need to add "../" to the css file reference in Index.php to make it work.
Check If A File Has Been Included Before?
I want my scripts to be warning and error free. Is it possible to check is a file has already been included as part of a "require", "require_once" or "include" call in the script? I guess I could just include everything and turn warnings/errors off, but I'd prefer not to do that.
Included PHP Code Not Parsed!?!
On a hired webserver, the php code that is in the files included with 'include_once' and 'include' command is not parsed. The php file which includes these parses just fine. The included php is also parsed just fine on my test apache. Example: Request 'www.myurl.com/page.php' on the browser, it runs correctly, including the file 'menubar.inc' into the outputted content. The file menubar.inc contains html and php, in the following manner: <img src="img/LogoV<? echo $tmp; ?>.png" border="0" /> On my test server that would be parse to, for example: <img src="img/LogoV4.png" border="0" /> Thus displaying an image. BUT, on the webmotel the html comes out without parsing, as: <img src="img/LogoV<? echo $tmp; ?>.png" border="0" /> :( ? I would ask the customer service, but I know it will take +10 days to get the answer.
No Error In Included Files
The problem is pretty simple. If I include a file <? include 'libs.php' ?> and this file contains an error (a missing ;), my php installation does not tell me anything. I simply receive no output.
Included Variables Are All Blank.
This is the first part of myblog.php, which is the page you see in the browser. <?php require("/home/www/htdocs/master.php"); //functions are in here $u = "test"; //username $htitle = "Test blog!"; //for <title> //includes dbcon(); //connect to database blog($u); // START PAGE echo $welcomemessage;Functions are in master.php. It calls function dbcon, which logs me into MySQL and selects the database. It calls function blog: function blog($u) { //not using $u for anything yet. require($path."blog/vars.php"); require($path."blog/head.php"); }Vars defines stuff needed for the blog, Head is the header, with <html>, <head>, etc. $welcomemessage is defined in vars.php, but it doesn't show anything when I echo it in myblog.php. I went into vars.php and made it echo in there, and it worked, so it is defined correctly and the file is included, but for some reason the variable goes blank by the time I get back to myblog.php. It's the same with all the arrays I defined in there too.
Product Image In Database For Froogle Feed
All the images for my products are stored in the database. I have to post a url for the image in my froogle feed. I used to put the URL I put in the src of the img file and that doesn't work anymore. If I remember correctly, putting http://<domain>/pic.php?id=47&table=table1&column=column_id just got me the picture, now IE tells me it failed downloading a file. Presumably it is because the browser doesn't know the type of the file returned whereas in the img tag it expect an image? Is there anyway to fix that please?
Running Php Included From A Mysql Database
I'd like to include php-code out of a mysql (or odbc) database on a php-page and run that code. Is that possible? I know howto include normal text(&html) from a database to a php-page. But I'd like to work with templates, therefore in need just a little bit php-code in my database. (and included on my pages).
Passing Arguments To Included Php Script
I am working on a server that does not allow PHP to be embedded into documents unless they are in the cgi-bin directory. This is annoying but I've been working around it with wrapper pages in other directories that contain only <!--include virtual="/cgi-bin/relevant_script.php" -->. One of my scripts is more difficult to work with because it is a collection of links, each of which points to the same script with different arguments. It is not acceptable to my boss to go to a URL like mysite.com/sub/script1.html (which just includes a script in cgi-bin) and have that link to mysite.com/cgi-bin/script2.php?arg1=blah . I want to have the script included in script1.html to link to another wrapper page that takes arguments (script2.html?arg1=blah) and have the included script take those arguments...
|