Current location: Hot Scripts Forums » Programming Languages » PHP » auto file running


auto file running

Reply
  #1 (permalink)  
Old 08-31-06, 10:08 AM
pkcidstudio's Avatar
pkcidstudio pkcidstudio is offline
Coding Addict
 
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
auto file running

so i had something in the script request and had not gotten anything so i decided to try coding on my own, for this one. here is my initial thought but i know i need a little help because i am missing a few components.
*what it does- checks the xml file and if the <pubDate> matches up then it submits it to the header location which allows it to ping. i need this file to run on a daily basis at i don't know midnight or something. and if it sees a file in there that matches the new date it will ping the header. now, if it doesn't, i don't want it to, but more importantly the way itunes works is any date that is the most future it takes that as the most current. so in my example on the code i want it to display the aug date, but not the sept date. any thoughts? here is the code. one more idea at the bottom.
PHP Code:

<?php

$publishDate 
date('D, j M Y G:i:s');
if (
$publishDate == '<pubDate></pubDate>'){
header("Location: https://phobos.apple.com/WebObjects/MZFinance.woa/wa/pingPodcast?feedURL=http://www.site.com/rss.xml");
} else {
exit();
}
?>

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>

<title>site</title>
<link>http://www.mysite.com</link>
<language>en-us</language>
<copyright>Copyright 2006 site.</copyright>
<itunes:subtitle>F T</itunes:subtitle>
<itunes:explicit>clean</itunes:explicit>
<itunes:author>site</itunes:author>
<itunes:summary>lipsum ipsum .</itunes:summary>
<description>lipsum ipsum .</description>
<itunes:owner>
<itunes:name>site</itunes:name>
<itunes:email>email@site.com</itunes:email>
</itunes:owner>
<itunes:image href="http://example.com/podcasts/everything/AllAboutEverything.jpg" />
<itunes:category text="Health">
<itunes:category text="Fitness &amp; Nutrition"/>
</itunes:category>
<itunes:category text="Sports &amp; Recreation"/>


<item>
<title>F T &amp; sdc</title>
<itunes:explicit>clean</itunes:explicit>
<itunes:author>site</itunes:author>
<itunes:subtitle>sdc</itunes:subtitle>
<itunes:summary>lipsum ipsum .</itunes:summary>
<enclosure url="http://www.dir.com/podcast/sdc.m4v" length="5203998" type="audio/x-m4a" />
<guid>http://www.dir.com/podcast/sdc.m4v</guid>
<pubDate>mon, 28 aug 2006 11:37:00 GMT</pubDate>
<itunes:duration>0:58</itunes:duration>
<itunes:keywords>F T &amp; sdc</itunes:keywords>
</item>

<item>
<title>F T &amp; sdc</title>
<itunes:explicit>clean</itunes:explicit>
<itunes:author>site</itunes:author>
<itunes:subtitle>sdc</itunes:subtitle>
<itunes:summary>lipsum ipsum .</itunes:summary>
<enclosure url="http://www.dir.com/podcast/sdc.m4v" length="5203998" type="audio/x-m4a" />
<guid>http://www.dir.com/podcast/sdc.m4v</guid>
<pubDate>mon, 4 sept 2006 11:37:00 GMT</pubDate>
<itunes:duration>0:58</itunes:duration>
<itunes:keywords>F T &amp; sdc</itunes:keywords>
</item>

</channel>
</rss>
the other idea i have is i have a php file with all the data if something matches up then it paste's the info onto the xml file which then post it. lets through around some ideas and come up with this program.
__________________
learning like everyone else
Reply With Quote
  #2 (permalink)  
Old 09-03-06, 04:05 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
i think i don't understand your problem completely, but this is what i understandof your explanation:
1. you have an xml file, containing a tag 'pubDat''.
2. you want to check in a script if there's a tag 'pubDate', and if the pubDate is newer or equal to the current date.
3. if so, you want to ping the file via the header
4. if not; nothing should happen.
5. you want all this automaticly done, every day

is this correct?

well i can help you with some points but not all:
1. read the xml file
2. use preg_match to check if the tags in present in the file. use the date function to get the current date, and use substr and strpos to retrieve the data, located within the pubDate node
3. just do as you showed in your script: header("location.....
5. i recommend using cronjob. or if you're running on a local server, writing it in another language, so it can automaticly start and end the script

hope this helps you out a little,
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 09-05-06, 08:55 AM
pkcidstudio's Avatar
pkcidstudio pkcidstudio is offline
Coding Addict
 
Join Date: Nov 2005
Posts: 332
Thanks: 0
Thanked 0 Times in 0 Posts
i am open to any all suggestions.
__________________
learning like everyone else
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Create Webpage For a File? jives PHP 7 08-29-06 04:39 AM
Upload a file to a fix web folder of a website without using FTP software sujata_ghosh Perl 4 05-10-06 09:10 AM
Error message not getting displayed. sanjeet Windows .NET Programming 0 12-20-05 10:48 AM
Getting the created file (fopen/fwrite) Programme PHP 5 02-14-04 03:09 PM
Upload file type and size limiter! Arctic ASP 1 08-02-03 07:06 PM


All times are GMT -5. The time now is 07:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.