Jump to content

bschultz

Members
  • Content Count

    465
  • Joined

  • Last visited

Everything posted by bschultz

  1. This is always echoing FIRST...even for today (12/30)...any ideas why? <?php $year = date('Y'); $yearplus = ($year + 1); $first = date('m-d', strtotime("12-25")); $second = date('m-d', strtotime("01-01")); if (date('m-d') <= $first || date('m-d') >= $second) { $first_monday = date('Y-m-d', strtotime("January 2 $year last Monday")); echo "FIRST"; } else { $first_monday = date('Y-m-d', strtotime("January 2 $yearplus last Monday")); echo "SECOND"; } echo $first_monday; exit; ?>
  2. The broadcast industry (radio and TV) has a special calendar. The week starts on Monday. Week #1 is ALWAYS the week with January 1st. So, if January 1st is on a Sunday, week #1 will include December 26th through January 1st. This differs from the ISO standard used by PHP. I don't know where to start to write a function to give me the broadcast calendar week numbers for a given date. Google didn't have much...and Stack Overflow had a couple examples...but none of them worked. They all showed today being week #53, where today (December 30) is in week #1. Any help would be appreciat
  3. This is fixed. Turns out one of the pages that the 4th page was calling via GET does NOT require a password, and it has all the content I need. I exploded the string it returned and got all the info I needed. Thanks.
  4. Maxxd, when using a browser, there is a button to press to go from page 1 to page 2. This button is just a link, so the second curl request uses this link as the URL. Using Firefox Developer Tools - Network, page #4 makes two GET calls to two other pages (which includes the SQL Selects), then the content loads on page #4 Here are the two external page requests curl 'http://209.151.229.186/AffWeb_USRN/V2/ASP/GTD.asp?SQLCMD=spGetStationOptions%20%27WBJI-FM%27,%20%27Virtual%20News%20Network%20MF%27,%20%2710/19/2020%27,%20%2710/19/2020%27&DT=1603034713365' -H 'User-Agent: Mozill
  5. 4 pages deep means login page (page 1). Simulate a link click to page 2. Simulate a link click to page 3. Simulate a link click to page 4. Pages 2 and 3 have no javascript or Ajax coding. Page 4 does! Pages 2 and 3 have some coding that is tied to the login to display certain info. As far as I can tell, page 4 uses AJAX to set some database calls...thus without the AXAX info passed via CURL, I get AJAX:0 error. I'm assuming the AJAX:0 error is in the code of the page...but when I visit that page via a browser, it works...so no error. What code would you like me to post? Page 1,
  6. I'm trying to login and scrape a page 4 pages deep. I can get to the fourth page...but that page only returns AJAX ERROR:0. I know NOTHING about AJAX calls via Curl. Can someone please help me with what to look for in the source code of the 4th page (when using a browser) to what I'm supposed to pass along via CURL? If you need the source code or login credentials to see what's happening in the background, I can generate a temp password for you. Thanks!
  7. Upon further investigation, there is a cookie being set by a JQuery script...which in turn sets the rowid. So, how can I get CURL to interact with Java? Headless browser? I've never had much success with headless browsers before. Any tips? Thanks!
  8. But the rowid isn't set until you submit the form...so parse-url returns NULL. The flow of the login is: login page -> formprocessing page -> landing page. In the script, I'm sending a POST to the form processing page. Once that is done, the form processing page sets the rowid. I can see the rowid in my browser, but CURL doesn't know that value.
  9. My real job is as a radio announcer. We are required to play advertising commercials for various programs that we broadcast. I wrote a script a few years ago to automatically login to the providers website (PHP, Curl) and download the mp3's that we are supposed to play each day. Now, the provider has updated their website and changed the login process. It used to be (in a browser) that when you logged in, you were taken to a landing page with a unique "rowid" in the in URL. Once you knew that rowid, you could simply go to that page, and bypass the login process. Not very secure...but
  10. I have a given date on a webpage, that I'm scraping to insert into a DB. The date is in this format: Sun, Feb 9<br />3:00 PM ET I need to insert this into the DB in this format: 2020-02-09 15:00:00 It will always be this year...How can I change this data to be inserted correctly? I'm trying this...and it's inserting as 1969 $date = 'Sun, Feb 9<br />3:00 PM ET': $healthy = array("<br />", " ET", "Sun.", "Mon.", "Tue.", "Wed.", "Thu", "Fri.", "Sat.", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); $yummy = array(" ", "2
  11. I got it working...left the dollar sign out of the function call getplayer('qb1'); and then an if / elseif statement inside the function: if ($position == 'qb1') { $new_position = $qb1; } elseif ($position == 'qb2') { $new_position = $qb2; } Thanks....
  12. I've tried that...the echo of the sql shows the name is blank
  13. I have a php file with a bunch of variables declared. I now need a function to put data on a separate page that pulls variables from the required page. So, on the required page, I have a variable set like this: $qb1 = "John Doe"; The function on the new script is called like this: getplayer($qb1); I've tried this without the dollar sign in the function like this: getplayer(qb1); and then adding the $dollar sign in the rest of the function code...but it never populates the sql query correctly. I'm guessing this is a case for variable variables or something similar, but I don't know
  14. I'm replacing Wordpress with my own content management system. Wordpress is just too bloated for my liking. The url's for the mp3's are embedded into the stories. Our final Beaver Fever Friday of the year was yesterday. What a show. It's always nice to get to know these seniors over their careers. Here are the interviews if you missed them: Christa Benson - Track <a href="http:///beaverradionetwork.com/audio/1011/brnpodcasts/BFF2019/ChristaBenson.mp3">Christa Benson - Track</a><br /><br /> Cody Cook - MGolf <a href="http:///beaverradionetwork.com/audio/10
  15. I'm finally moving away from Wordpress. I've used a couple of different mp3 players in the past, and I need to figure out how to replace a link to an mp3 file or just some text with xxx.mp3 with an html5 audio player. The one plugin I used replaced all links with a player button...another plugin I used you only needed to have .mp3 at the end, and it would replace the text with a button player. I have a VERY hard time wrapping my head around regex. How can I accomplish these two scenarios with 1 regex? <a href=http://domain.com/soundfile1.mp3>Some File</a> and http
  16. Here's the function... function media_shooter_date ($show, $date_of_directory) // show is daily or weekend...date of directory is the date to expect from the media shooter directory { $todays_dow = date('l'); // Sunday, Monday...etc if ($show == "daily" && $todays_dow == "Sunday") { $media_shooter_date_diff = "+1 day"; } if ($show == "daily" && $todays_dow == "Monday") { $media_shooter_date_diff = "+0 day"; } if ($show == "daily" && $todays_dow == "Tuesday") { $media_shooter_date_diff = "-1 day"; } if ($show == "daily" && $todays_dow == "Wednesday")
  17. I have confirmed the date is correct... Here's the code: $this_show_date = media_shooter_date ("Saturday", "Saturday"); echo "This show date = $this_show_date\n"; /* // This is the old code...that does NOT check for the date $dir = "/showdownloads/MediaShooter/MediaShooterDrop/*Years\ of\ Hits*"; foreach(glob($dir) as $file) { $files = glob("$file/*.*"); foreach($files as $audio){ $file_to_go = str_replace($file,"",$audio); copy($audio, '/showdownloads/25Years/' . $file_to_go); } } */ $path = "/showdownloads/MediaShooter/MediaShooterDrop/"; $dir = new DirectoryIte
  18. Changing the code to replace strpos with stripos still didn't match anything.
  19. I'm trying to loop through a directory for subdirectory names. If a subdirectory matches needle and haystack...loop through that directory and proceed. Here's the code $this_show_date = media_shooter_date ("Saturday", "Saturday"); $path = "/showdownloads/MediaShooter/MediaShooterDrop/"; $dir = new DirectoryIterator("/showdownloads/MediaShooter/MediaShooterDrop/"); foreach ($dir as $fileinfo) { echo "$fileinfo\n"; if ($fileinfo->isDir() && !$fileinfo->isDot()) { if (strpos($fileinfo->getFilename(), "Years of Hits") !== false && strpos($fileinfo->getF
  20. Barand, Many thanks...I would NEVER come up with that. Very much appreciated!
  21. The more I think of this...that logic won't work either. What if a special show runs for 6 hours? That would never fall between start and end of any one show. That would fall somewhere between Show #1 and Show #3 Not going to lie...this is far and away above anything I've ever written before.
  22. OK...so I read up on multidimentional arrays. I'd say this is headed in the right direction...but how do I work the logic for if special starts BEFORE the PREVIOUS regular? $regular = array( array( "title" => "Regular #1", "start" => "2018-04-02 12:00:00", "end" => "2018-04-02 15:00:00" ), array( "title" => "Regular #2", "start" => "2018-04-02 15:00:00", "end" => "2018-04-02 18:00:00" ), ); $specialty = array( array( "title" => "Special #1", "start" => "2018-04-02 18:00:00", "end" => "2018-04-02 19:00:00" ), );
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.