0

How can I get from http://server.com/edf/ghj in php?

I tried

$foo = '<iframe src="http://server.com/edf/ghj" scrolling=no></iframe>';
preg_match('src=\"(.*?)\"',$foo,$m);

preg_match is returning false and $m is returning null.

Erick Engelhardt
  • 704
  • 2
  • 10
  • 30
  • 2
    Please [enable error reporting](http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php), and it will tell you immediately what's wrong with your regex: you forgot to add delimiters. – Wrikken Nov 27 '14 at 21:24

1 Answers1

0

Easy as @Wrikken said (and Mark-b corrected).

Just added delimiters to pattern: '~src=\"(.*?)\"~'

Erick Engelhardt
  • 704
  • 2
  • 10
  • 30