• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

PHP removing string in URL's source

Hello,

i am currently making a script  which is stripping some data off an internet site. Now one of the lines are troubling me and those are the ones with current date in it.

I am sure i could strip those too with some universal command but i am not sure which one.

So string look like this:  <report date="2012-08-31" valid="2012-09-01">

I need to remove whole string and not just dates in it.

Thank you!
0
Caruso_eu
Asked:
Caruso_eu
  • 2
1 Solution
 
acbxyzCommented:
Can you be a bit more specific.

If the line is static, with a fixed dated, you can use str_replace to remove parts of a string. If it is dynamic, you can use preg_replace
$newstring = preg_replace('/<report date="\d\d\d\d-\d\d-\d\d" valid="\d\d\d\d-\d\d-\d\d">/', '', $oldstring);

Open in new window

0
 
Caruso_euAuthor Commented:
Exactly what i needed!

Thank you!
0
 
Ray PaseurCommented:
Please post the URL of the internet site so we can see the source that you want to strip.  Then we can give you a tested code sample.

You can probably use this function:
http://us.php.net/manual/en/function.strip-tags.php#93567
0
 
Caruso_euAuthor Commented:
Ray_Paseur : Thank you but solution to my problem was posted already!

Thank you!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now