Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

preg_match_all & regexp

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

preg_match_all & regexp

Postby ashok » Mon May 13, 2013 3:46 am


I am not getting any output with this code. Is the regular expression correct?

url to match[0]=2&page=1&search=1

my code:
Code: Select all
public function get_vendors() {

      $url = $this->generate_url(intval($_REQUEST['id']));
        $a = $this->http->open($url,'');

        $vendros = array();

        if (preg_match_all("/href=\"\?car=([0-9]*)&[a-z0-9&=&%]*\">([a-z0-9\s\-а-яА-Я\/`\(\)'\"]*)<\/a>/Uims",$a,$m)) {
         foreach($m[1] as $k => $v) {
            $vendors[$v] = $m[2][$k];


         return $vendors;


New php-forum User
New php-forum User
Posts: 1
Joined: Mon May 13, 2013 3:24 am

Re: preg_match_all & regexp

Postby johnj » Tue May 14, 2013 5:53 am

php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.