• Resolved Peter Hardy-vanDoorn

    (@petervandoorn)


    Two things to report here.

    1. I’m finding that basehref replacement is limited as it is not picking up inline background image styles. EG: <div style="background-image:url(/b392bd629.jpg);">.

    2. In attempting to get around this using the replace_query function, I’m getting an error from preg_replace: Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in /html/wp-content/plugins/wp-web-scrapper/class.wpws.php on line 258

    Code I’m using is

    echo wpws_get_content('http://www.mysite.co.uk', '.tx1_ab1', array( 'replace_query' => 'url\(', 'replace_query_type' => 'regex', 'replace_with' => 'url(http://www.mysite.co.uk' ) )

    I believe that my regex is correct as I have tested it using 3 different sites: http://www.phpliveregex.com/, http://www.regexplanet.com/advanced/java/index.html and http://www.rubular.com/

    Thanks

    https://ww.wp.xz.cn/plugins/wp-web-scrapper/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Peter Hardy-vanDoorn

    (@petervandoorn)

    Oops. Just realised that I’ve missed off the opening & closing / for the replace_query!

    First point still stands though.

    Thread Starter Peter Hardy-vanDoorn

    (@petervandoorn)

    More baseref woes.

    The site I’m trying to scrape has images with src="/v/nr/i/t.png" but basehref is changing the url incorrectly. It’s changing it to src="http://www.mysite.co.uk/nr/t.png" – ie, it’s removing the /v/ and /i/ parts of the path!

    It’s also doing the same with the <a> links – it’s removing the /v/ from the beginning of those too.

    Plugin Author Akshay Raje

    (@akshay_raje)

    Try explicitly mentioning a basefref with the right URL rather than relying on the auto thing. And yes, it is limited to only src and href tags (not CSS)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘basehref error and preg_replace delimiter error’ is closed to new replies.