NameSilo

PHP replace question

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

NetworkTown.Net

Account Closed
Impact
2
Hi

I am making a script and i got stuck i have something like this:

HTML:
<div><object width="400" height="240"><param name="movie" value="http://www.dailymotion.com/swf/2RzUuxVDPylcK4iPV"></param><param name="allowfullscreen" value="true"></param><embed src="http://www.dailymotion.com/swf/2RzUuxVDPylcK4iPV" type="application/x-shockwave-flash" width="400" height="240" allowfullscreen="true"></embed></object><br /><b><a href="http://www.dailymotion.com/video/xlzgb_horn-ok-please">"HORN OK PLEASE"</a></b><br /><i>Uploaded by <a href="http://www.dailymotion.com/flickerpix">flickerpix</a></i></div>

Now i want to use php to repace the width & height to 200 each but on every video i will have it will have a diffrent width and height so i need something in php that will work with repace width="any number" anyone help me with this one.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Best way to do this is using a regex (rules) parsing function such as preg_replace.

Example:
PHP:
// $string = your html
preg_replace("/(width|height)=\"[0-9]+\"/i", "\\1=\"200\"", $string);

Untested but should work :) Got bored, tested and works.

Matt
 
Last edited:
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back