PHP - Find All Images In A Website
Hi, I have a php code that is used to find all the images in a website using simple_html_dom. When I tried to run it, this error occured:
Fatal error: Call to a member function find() on a non-object in C:\xampp\htdocs\myPHP\index.php on line 20
This is my code:
<!DOCTYPE html> <html> <body> <?php include_once("simple_html_dom.php"); //use curl to get html content function getHTML($url,$timeout) { $ch = curl_init($url); // initialize curl with given url curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]); // set useragent curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // max. seconds to execute curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error return @curl_exec($ch); } $html=getHTML("http://www.website.com",10); // Find all images on webpage foreach($html->find("img") as $element) echo $element->src . '<br>'; ?> </body> </html>I have the simple_html_dom.php file in my directory. How can I correct this? thanks Edited by Raex, 20 August 2014 - 09:05 PM. Similar TutorialsHi All, I'm new at php and I need your help. I'm trying to find a string in a website. I want my website to get a string on another website(I have full access) without really opening it on a browser. For example the string is "MyID=123456", i want to find "MyID=123456"(the MyID number is random and always changing but always 6 random numbers) on another website and output only "123456" on my website. Is this possible? Please help. Thanks Hi I'm not sure if this needs to be in the MySQL forum so bare with me. I have small script which parses an RSS feed and inserts data into a table. This all works fine, but my problem now, is that I have another table, which has logos and when i parse the RSS, I'd like to be able to pass in the logo from the logos table into the RSS parse table. The problem is the RSS feed are products, with different suppliers, so I need to somehow check which manufacturer it is and then insert the image_id from the images table. I have a field in the main table, which has things like 'Available at Amazon' and 'Available at Play.com' What I want is some kind of join/like clause, where I can check, for example the word 'Amazon' in one field and match it to the images table. schema of both tables rss_table id, title, message, price, logos_id 1, iPad, Available at Apple, 400.00, BLANK_ID logos id, name, src 2, Apple, apple-logo.jpg So you can see, any product that gets parsed that has is available at apple, needs to have the logos_id of 2, if that makes sense? Below is a small snippet of my code (it isn't brilliant but works) I just need to then need to find the corresponding image to the manufacturer <?php $test = $_POST['post_title']; $articles = array(); $easy_url = $_POST["url"]; $rawFeed = file_get_contents($easy_url); $xml = new SimpleXmlElement($rawFeed); $channel = array(); $channel['title'] = $xml->channel->title; $channel['link'] = $xml->channel->link; $channel['description'] = $xml->channel->description; foreach ($xml->channel->item as $item) { $article = array(); $article['title'] = $item->title; $article['link'] = $item->link; $article['description'] = (string) trim($item->description); preg_match_all('/&#xA3;([0-9.]+)/', $item->description, $results); foreach ($results as $k => $v) { } $all = '&#xA3;'.$v[0]; $price_stripped = str_replace($all, '', $item->description); $desc = preg_match('/&#xA3;([0-9.]+)/', $item->description); preg_match_all('/~#£([0-9.]+)/', $item->description, $discount); foreach ($discount as $d => $disc) { str_replace("~#£","", $disc[0]); } preg_match_all('/£([0-9.]+)/', $item->description, $delivery_cost); foreach ($delivery_cost as $del => $deliv) { } preg_match_all('/\|(.*?)\./',$item->description,$match); foreach ($match as $rel => $retail) { $retail[0] = str_replace("|","", $retail[0]); } //$retail_logo = str_replace('On sale at', '', $retail[0]); $connection = mysql_connect("localhost","root","password"); if (!$connection) { die('Could not connect: ' . mysql_error()); } $total = $v[0] + $deliv[0] - $disc[0]; mysql_select_db("db_test", $connection); mysql_query("INSERT INTO rss (title, price, retailer_message, logo_id) VALUES ('$item->title', '$price_stripped', '$retail[0]', '$logo_id')"); mysql_close($connection); } ?> Any help is appreciated. Thanks Hey, Im wondering how I go about creating a directory path to an image folder that can be opened from any folder inside my root web directory www/WEBROOT/IMAGES/SHOP/image.jpg When i add an absolute path to the images url in the database when its gets executed it will run the the path from the current folder. I was wondering how to make its always start looking for files from the root directory down instead of the current location. The reason im asking this is that i was to be able to open those images from seperate locations inside my website. Thanks I'm trying to make a League of Legends (a video game) community website, both as a personal project and for practice. Now the game has a lot of champions, each of whom have 5 unique abilities. Now, I thought about manually inputting all the details about each champion into a MySQL database, but that would long and tedious, and I don't really have the time for it now. Also, the game patches very oftern (like, once every 2 weeks) which changes many of the stats, etc. of the champion, and it is not possible for me to keep manually updating these every time there is a patch. Fortunately, there is a League of Legends Wiki which has all the data I need in their specific champion pages, which they keep updated per patch. So I was wondering if there was any way to get the data from the divs in the wiki, and have it display on my site. What I want to do in my website is that whenever someone types a champion's name (in a post or whatever), I want it to display a hover-over dialog with some of the champions details. And a lot of other features such as that. In plain English I need a way to : > Tell PHP to go to the wiki's source code on a specific page > Find a specific div container > Get X data from there > Pass X data into a function to display the hover-over I think this way, I would not have to maintain a database as I can leech off the wiki's data. I have not coded anything like this before, so I would like a few pointers as to how to achieve this. Any help will be appreciated! hello My database is in a same server with seperate domain name , then I want to insert from website1 mysql data on website2 mysql data. can anyone help me? I tried searching on google but couldn't find any relevant information, please redirect me to relevant source or help me with the code. I want to pass a domain name in text field which will be scanned and then the script will display entire site map. Not external links or links on a page. Sorry it is not easy for me to explain. Eg. if i pass abc.com Script will display abc.com/12/adn.php abc.com/asd/asd/ etc Whatever their url format is. All the links on that domain. I have this script from http://lampload.com/...,view.download/ (I am not using a database) I can upload images fine, I can view files, but I want to delete them. When I press the delete button, nothing happens
http://www.jayg.co.u...oad_gallery.php
<form>
<?php $dir = dirname(__FILENAME__)."/images/gallery" ; $files1 = scandir($dir); foreach($files1 as $file){ if(strlen($file) >=3){ $foil = strstr($file, 'jpg'); // As of PHP 5.3.0 $foil = $file; $pos = strpos($file, 'css'); if ($foil==true){ echo '<input type="checkbox" name="filenames[]" value="'.$foil.'" />'; echo "<img width='130' height='38' src='images/gallery/$file' /><br/>"; // for live host //echo "<img width='130' height='38' src='/ABOOK/SORTING/gallery-dynamic/images/gallery/ $file' /><br/>"; } } }?> <input type="submit" name="mysubmit2" value="Delete"> </form>
any ideas please?
thanks
The issue I'm having is that this query won't find a max value record if it has less than 5 votes. It'll only show the results of an entry has 5 or greater votes. Why is that? $contest_id = 5; $category_id = 8; $find_entries = $db->prepare("SELECT entry_id, user_id, votes FROM contest_entries WHERE contest_id = :contest_id AND category_id = :category_id AND e_status = :e_status AND votes = (SELECT MAX(votes) FROM contest_entries) LIMIT 1"); $find_entries->bindParam(':contest_id', $contest_id); $find_entries->bindParam(':category_id', $category_id); $find_entries->bindValue(':e_status', 0); $find_entries->execute(); $result_entries = $find_entries->fetchAll(PDO::FETCH_ASSOC); if(count($result_entries) > 0) { foreach($result_entries as $row) { $entry_id = $row['entry_id']; $user_id = $row['user_id']; $votes = $row['votes']; } echo $entry_id; } else { echo 'nothing'; } Edited June 26, 2019 by imgrooot Hey, What function / how would I find if a string has something? Say I have a string like: $string = 'Hello their! This is my post :) btw, my name is Justin.'; Say I wanted to find out if my name "Justin" is inside that string.. so: whateverfunction('Justin', $string) So I think you should get my idea now though Thanks a lot! Hi I downloaded a PHP script, copied at localhost and when I run it, it will not display all results instruction says that Globals should be off in PHP.ini and scripts should work while Globals are off. but I can't find php.ini in XAMPP. I tried xampp/apache/bin but I didn't find php.ini what should I do? Please help...I'm going blind!!! I am trying to set up a simple feedback form on a website. The form is at www.hotelguestdirect.com if you need to see that. This is the error I get...Parse error: syntax error, unexpected ',' in /home/content/h/o/t/hotelguestdir/html/survey.php on line 160 Here is my code <?php // Field Mapping $sFirstName = $_POST["txtFirstName"]; $sLastName = $_POST["txtLastName"]; $sHomeCity = $_POST["txtHomeCity"]; $sHomeState = $_POST["selHomeState"]; $sCountry = $_POST["selCountry"]; $sHotel = $_POST["txtHotel"]; $sCity = $_POST["txtCity"]; $sState = $_POST["selState"]; $sStayLength = $_POST["selStayLength"]; $sHowHelpful = $_POST["txtHowHelpful"]; $sImprovements = $_POST["txtImprovements"]; if (($sHotel == "") || ($sCity == "") || ($sState == "") || ($sStayLength == "") || ($sFirstName == "")) { print('<span style="color:#333; font-size:14px;">Please complete the required fields <a style="color:#333" href="index.html" onClick="history.go(-1);">Click here to go back</a></span>'); } else { $sMailFrom = 'info@hotelguestdirect.com'; $sMailTo = 'graphics.hgd@gmail.com'; $sMailSubject = 'Guest Survey - Key Holder Brochures'; $sMailBody = '<p>Guest Response Survey</p> <b>Hotel: </b>' . $sName . '<br /> <b>City: </b>' . $sCity . '<br /> <b>State: </b>' . $sState . '<br /> <b>Lenth of Stay </b> ' . $sStayLength . '<br /> <b>How was the brochure helpful: </b>' . $sHowHelpful . '<br /> <b>Input or Improvements: </b>' . $sImprovements . '<br />'; $sMailHeaders = "From: $sMailFrom\n"; $sMailHeaders = "Content-Type: text/html; charset=iso-8859-1\r\n"; if (mail($sMailTo, $sMailSubject, $sMailBody, $sMailHeaders)) { print('<span style="color:#333; font-size:14px;"><div align="center"><br /><br />Thank you, your information has been emailed!</div></span>'); } else { print('<span style="color:#333; font-size:14px;"><div align="center"><br /><br />Could not send e-mail, please contact the webmaster!</div></span>'); } } ?> The program found here http://www.myadtoolz.com/download/cpuid.zip shows a cpuid? I dont know what that is but it seems unique for every system, I feel this could be the way to have scripts that I sell verify with the user, how would I make a script to find that cpuid? thanks hello I've some code and I want find and cut url from it using php. this url link between 1 - 5 link. this mean some times 1 URL in the code sometimes 2 url in the code and ... can anyone help me? Code: [Select] MB</div><br/> <br/> <br/> <b><br/> DOWNLOAD<br/> <br/> <a href="http://uploading.com/files/c2182562/LIBERO%252B24%252BLUGLIO%252B2010.pdf/" target="_blank" rel="nofollow">http://uploading.com/files/c2182562/LIBERO%2B24%2BLUGLIO%2B2010.pdf/</a><br/> <br/> <br/> <br/> <br/> <a href="http://rapidshare.com/files/408736098/LIBERO_24_LUGLIO_2010.pdf.html" target="_blank" rel="nofollow">http://rapidshare.com/files/408736098/LIBERO_24_LUGLIO_2010.pdf.html</a></b> </div> <table class='file-express' width='100%'> <tr> <td style='text-align: left; color: #B2AC94; font-size: 3'><br>titletm= LIBERO 24 LUGLIO 2010 LIBERO 24 LUGLIO 2010 :found<br><font color="blue">2</font>http://www.avaxhome.ws/magazines/everyday_practical_electronics_vol_33_no_5_2004.html<br>File exists.dllink'MB</div><br/> <br/> <br/> this code works fine it I take out the checkboxes(repair & replace) in the html & PHP ? Code: [Select] <form name="form" action="<?php $_SERVER[PHP_SELF] ?>" method="post"> <input type="text" size="2" name="apt" id="apt" onkeyup="getResults();if(this.value.length==this.size)document.form.datereceived.focus();" />Apt<br /> <input type="text" size="25" name="name" id="name" />Name<br /> <INPUT TYPE="text" size=10 name="datereceived" onKeyUp="if(this.value.length==this.size)document.form.time.focus();">Date Received<br /> <INPUT TYPE="text" size=7 name="time">Time Received<br /> <br>Kitchen <select name="item"> <option value="kitchen blinds" selected>kitchen blinds</option> <option value="kitchen bifolds">kitchen bifolds</option> <option value="kitchen lights">kitchen light fixtures</option> <option value="kitchen bulbs">kitchen light bulbs</option> <option value="kitchen tile">kitchen tile/linoleum</option> <option value="kitchen countop">kitchen counter top</option> <option value="kitchen cabinets">kitchen cabinets</option> <option value="kitchen drawers">kitchen drawers</option> <option value="fridge">refidgerator</option> <option value="stove">stove</option> <option value="range hood">stove hood</option> <option value="kitchen sink">kitchen sink</option> <option value="under kitchensink">under kitchen sink</option> <option value="kitchen faucet">kitchen faucet</option> <option value="kitchen drain">kitchen drain</option> <option value="kitchen screens">kitchen windows & screens</option> <option value="fire extinguisher">fire extinguisher</option> <option value="kitchen wall plates">kitchen switch plates</option> <option value="kitchen outlets">kitchen electrical outlets</option> <option value="kitchen ceilings">kitchen ceiling paint</option> <option value="kitchen wallpaint">kitchen wall paint</option> </select> <br> repaired <input type=checkbox name="repair" value="Y"> replaced <input type=checkbox name="replace" value="Y"><br> </p> action<INPUT TYPE="text" size=100 name="action"><br /> <INPUT TYPE="text" size=2 name="compday" MAXLENGTH=2 onKeyUp="if(this.value.length==this.size)document.form.compmoyr.focus();"> <INPUT TYPE="text" size=7 name="compmoyr" MAXLENGTH=7 Date Completed - <font color=red>day then mm/yyyy</font <br /><br /> cost<INPUT TYPE="text" size=4 name="cost"> charge<INPUT TYPE="text" size=4 name="charge"> Order#<INPUT TYPE="text" size=4 name="ordno"> - If Insp <p> <INPUT type="submit" value="submit data" /> </p> </form><?php if (isset( $_POST['apt']) ) { $apt=$_POST['apt']; $name=$_POST['name']; $datereceived=$_POST['datereceived']; $time=$_POST['time']; $item=$_POST['item']; $repair=$_POST['repair']; $replace=$_POST['replace']; $action=$_POST['action']; $compday=$_POST['compday']; $compmoyr=$_POST['compmoyr']; $cost=$_POST['cost']; $charge=$_POST['charge']; $ordno=$_POST['ordno']; $stat = mysql_connect("localhost","root","") or die('Unable to connect to database: ' . mysql_error()); $stat = mysql_select_db("maintdb") or die('Unable to select database: ' . mysql_error()); $query = " INSERT INTO maintdata (apt,name,datereceived,time,item,repair,replace,action,compday,compmoyr,cost,charge,ordno) VALUES('$apt','$name','$datereceived','$time','$item','$repair','$replace','$action','$compday','$compmoyr','$cost','$charge','$ordno')"; echo "apt $apt data inserted</font><br /><br />"; $stat = mysql_query($query) or die('Query failed: ' . mysql_error()); mysql_close(); } ?> I have a long string of html, and what I want to do, if find all occurrences of: /static (anything after)... and replace with: http://www.mydomain.com/static (anything after). What is the best and fastest way to do this? Thanks. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <?php // Connect to database================================================== include("connect_db.php"); // sending query =========================================================== $result = mysql_query("SELECT * FROM members Order By last") or die(mysql_error()); if (!$result) { die("Query to show fields from table failed"); } echo "<br />"; echo "<p>MEMBERS LIST</p>"; echo "<table border='10' cellpadding='3' cellspacing='2'>"; echo "<tr><th>First Name</th><th>Last Name</th>><th>Phone</th><th>Email</th></tr>"; // keeps getting the next row until there are no more to get ================ while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table ========================== echo "<tr><td>"; echo $row['first']; echo "</td><td>"; echo $row['last']; echo "</td><td>"; echo $row['phone']; echo "</td><td>"; echo $row['email']; echo "</td></tr>"; } echo "</table>"; ?> </body> </html> This is the output. MEMBERS LIST > First Last Phone Email data data data data ect............................................................... I cannot find where the > (greater than) sign is coming from. There is a space after MEMBERS LIST but I could not get it to work in this display. Hi, This piece of code below stops site loading, can't find the problem Please help. If i remove the whole of this the site loads but does not function correct. Code: [Select] if ( $_GET[sssess] ) { session_id( $_GET[sssess] ); } session_start( ); header( "cache-control: private" ); if ( isset( $_GET[redeempoints] ) && $_GET[redeempoints] == "Y" ) { $_SESSION[redeemer] = "Y"; } if ( $_POST[purchaseorder] ) { $_SESSION[po] = "{$_POST['purchaseorder']}"; } if ( !$_SESSION[loginemail] ) { $_SESSION[loginemail] = "noemail@site"; } if ( !$_SESSION[adminemail] ) { $_SESSION[adminemail] = "noadmin@site"; } if ( $_POST[discode] ) { $_SESSION[discode] = trim( "{$_POST['discode']}" ); } $auth_ok_check = md5( "{$_SESSION['loginemail']}.{$hash}" ); $admin_ok_check = md5( "{$_SESSION['adminemail']}.{$hash}" ); if ( isset( $_GET['oidref'] ) ) { $GLOBALS['_GET']['oidref'] = mysql_real_escape_string( $_GET['oidref'] ); $sql = "SELECT o_id FROM order_list WHERE ref='".$_GET['oidref']."' AND unh='{$_GET['oidref']}'"; if ( !( $result = @mysql_query( $sql, $connection ) ) ) { exit( "**COULD NOT GET COPYRIGHT KEYS**" ); } if ( $row = mysql_fetch_array( $result ) ) { $_SESSION['unh'] = $_GET['oidref']; header( "location: ".$sshopurl."orderdetails_os.php?o_id={$row['o_id']}" ); exit( ); } if ( $_SESSION['auth_ok'] == $auth_ok_check ) { header( "location: ".$sshopurl."secure/orders.php" ); exit( ); } header( "location: ".$sshopurl."secure/login.php?next=orders.php" ); exit( ); } if ( preg_match( "/secure/", "{$_SERVER['PHP_SELF']}" ) && !preg_match( "/doqreg.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/qreg.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/voicepaycallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/secpaysecpagecallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/vps_handle_protx_response.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/protx/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/protxformcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/protxcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/worldpaycallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/securetradingcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/barclayscpicallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/paypalcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/moneybookerscallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/nochexcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/offlinecallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/doregister.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/register.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/doprereg.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/login.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/dologin.php/", "{$_SERVER['PHP_SELF']}" ) ) { if ( $auth_ok_check != $_SESSION[auth_ok] ) { header( "Location: ".$sshopurl."secure/login.php?next={$_GET['next']}&shk&p={$_SERVER['PHP_SELF']}" ); exit( ); } if ( preg_match( "/secure/", "{$_SERVER['PHP_SELF']}" ) ) { $isaccount = "1"; } } if ( preg_match( "/".$adminDir."/", "{$_SERVER['PHP_SELF']}" ) && !preg_match( "/adlogin.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/forgetful.php/", "{$_SERVER['PHP_SELF']}" ) ) { if ( $admin_ok_check != $_SESSION[admin_ok] ) { header( "Location: ".$adminurl."adlogin.php" ); exit( ); } if ( preg_match( "/".$adminDir."/", "{$_SERVER['PHP_SELF']}" ) ) { $isadmin = "1"; } } $noadirs = count( $admin_dirs ); $i = 0; for ( ; $i <= $noadirs; ++$i ) { if ( !preg_match( "/admin\\/".$admin_dirs[$i]."/", "{$_SERVER['PHP_SELF']}" ) && preg_match( "/".$admin_dirs[$i]."/", "{$_SESSION['admin_type']}" ) ) { continue; } header( "Location: ".$adminurl."perms.php?noperm={$admin_dirs[$i]}" ); exit( ); } if ( !$_SESSION[shopper_type] ) { $_SESSION[shopper_type] = "1"; } if ( $_GET[setcurrency] == 1 ) { if ( $_GET[new_currency_id] ) { $GLOBALS['_POST'][new_currency_id] = $_GET[new_currency_id]; } $_SESSION['currency_id'] = $_POST[new_currency_id]; } if ( $_GET[clearptid] == Y ) { session_unregister( "ptid" ); } if ( $_GET[selectpostage] == 1 ) { if ( $_POST[selptid] == Free || $_POST[selptid] == free ) { session_unregister( "ptid" ); } else if ( isset( $_POST[selptid] ) ) { $_SESSION['ptid'] = $_POST[selptid]; } else { session_unregister( "ptid" ); } $GLOBALS['_POST'][selptid] = mysql_real_escape_string( $_POST[selptid] ); $sql1 = "UPDATE basket SET ptid='".$_POST['selptid']."' WHERE session_id='".session_id( )."'"; if ( !( $result1 = @mysql_query( $sql1, $connection ) ) ) { exit( "Couldn't execute request 1" ); } } i have the following code which should redirect the user to the index.php page, but instead it shows error 404 page not found....Please if anyone see the problem help me login.php <?php session_start(); ?> <html> <head> <title>Basic CMS | Admin area Login</title> </head> <body> <?php if (isset($_SESSION['user'])) { header("Location: index.php"); } else { ?> <form action="dologin.php method="post"> <table> <tr> <td><span>Username:</span></td> <td><input type="text" name="username" /></td> </tr> <tr> <td><span>Password:</span></td> <td><input type="password" name="password" /></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="login" value="Login"/></td> </tr> </table> </form> <?php } ?> </body> </html> dologin.php <?php session_start(); ?> <html> <head> <title>Basic CMS | Admin area Login</title> </head> <body> <?php if (isset($_SESSION['user'])) { header("Location: index.php"); } else { ?> <form action="dologin.php method="post"> <table> <tr> <td><span>Username:</span></td> <td><input type="text" name="username" /></td> </tr> <tr> <td><span>Password:</span></td> <td><input type="password" name="password" /></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="login" value="Login"/></td> </tr> </table> </form> <?php } ?> </body> </html> index.php <?php session_start(); if(isset($_SESSION['user'])) { ?> <html> <head> <title>Basic CMS | Admin area</title> </head> <body> </body> </html> <?php } else { header("Location: login.php"); } ?> Hello I am new thought I would ask help here as I was not getting much help on another forum. I have this code Code: [Select] <?php header("content-type: text/xml"); $rssfeed = '<?xml version="1.0" encoding="UTF-8"?>'; $rssfeed .= '<rss version="2.0">'; $rssfeed .= '<channel>'; $rssfeed .= '<title>My Price Savings Coupons.com Feed</title>'; $rssfeed .= '<link>http://www.mypricesavings.com</link>'; $rssfeed .= '<description>This is coupons.com feed</description>'; $rssfeed .= '<language>en-us</language>'; $rssfeed .= '<copyright>Copyright (C) 2011 mypricesavings.com</copyright>'; function compareFeeds($a, $b){ //this function will compare the "val" array element of each $itemRSS if ($a["val"] == $b["val"]) { return 0; } return ($a["val"] < $b["val"]) ? -1 : 1; } $doc = new DOMDocument(); $doc->load('http://rss.coupons.com/xmlserve.asp?go=14520kk5210'); $arrFeeds = array(); foreach ($doc->getElementsByTagName('item') as $node) { $itemRSS = array ( 'val' => $node->getElementsByTagName('value')->item(0)->nodeValue, 'image' => $node->getElementsByTagName('image')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'exp' => $node->getElementsByTagName('activedate')->item(0)->nodeValue ); array_push($arrFeeds, $itemRSS); } usort($arrFeeds, 'compareFeeds'); foreach($arrFeeds as $itemRSS){ $descrip = '<![CDATA[ <p><a href="'.$itemRSS["link"].'"><img src="'. $itemRSS["image"].'" align="left" border="0" height="80" width="80" alt="'.$itemRSS["desc"].'"/></a></p>]]>'; $descrip .= '' .$itemRSS["desc"]; $rssfeed .= '<item>'; $rssfeed .= '<title>' . $itemRSS["desc"] . '</title>'; $rssfeed .= '<link>' . $itemRSS["link"] . '</link>'; $rssfeed .= '<pubDate>' . $itemRSS["exp"] . '</pubDate>'; $rssfeed .= '<description>'. $descrip . '</description>'; $rssfeed .= '</item>'; } $rssfeed .= '</channel>'; $rssfeed .= '</rss>'; echo $rssfeed; ?> The purpose of this code is to take http://rss.coupons.com/xmlserve.asp?go=14520kk5210 and turn it into a true RSS Feed. I currently have the php above at mypricesavings.com/coupons/couponsfeed.php I receive the error in google chrome on mac, however, in safari it does work, If I were to use RSS Graffiti on facebook it also errors Thank you for any help, Also, If there is a better more efficient way to accomplish what I am trying to do, please share with me so I may learn better Derrick |