cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: images and display issues on popup window

From: ryan pal <ryanpal_at_mail.com>
Date: Mon, 2 Jun 2008 13:06:26 -0500

Hi Stephen, Where would that code go? Do I str_replace on the result
that curl provides and then return that result? Ryan

  ----- Original Message -----
  From: "Stephen Pynenburg"
  To: "curl with PHP"
  Subject: Re: images and display issues on popup window
  Date: Sun, 1 Jun 2008 12:25:16 -0400

  Have a look at this:
  $str=preg_replace('#(href|src)="([^:"]*)("|(?:(?:%20|\s|\+)[^"]*"))#','$1="http://TARGET.SERVER.COM/$2$3',$str);

  (credits to
  http://wintermute.com.au/bits/2005-09/php-relative-absolute-links/)

  I tested it, and it works almost perfectly, except if there's a
  leading slash, it displays it as
  http://server.com//directory/file.ext
  Also, obviously it won't work for ../../, ./, etc.

  Cheers,
  Stephen

  2008/6/1 Colleen R. Dick <platypus_at_proaxis.com>:

    I do something similar, and the same issues. My guess is because
    the html that you are fetching for the xternal site probably has
    relative links to the images. So you would have to find all
    those links in the returned page and patch in the full URL to the
    images before displaying the page.

    ryan pal wrote:

      hello everyone. i have a link on my website which calls curl
      in the background. im trying to have a new window popup ,do
      a form submit to another site, and then display the results.
       right now the pages submits correclty, however some of hte
      images are not displayed and "errors" on the page occur. is
      this the just the way curl behaves or is there a workaround
      so that i can have this new window seem as if it's a direct
      link?
       ryan

      --
      * Mail.com Autos * <http://www.oncars.com>- Powered by
      Oncars.com: Drive By Today!
      ------------------------------------------------------------------------

      _______________________________________________
      http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

    _______________________________________________
    http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

  _______________________________________________
  http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

-- 
Mail.com Autos- Powered by Oncars.com: Drive By Today!
http://www.oncars.com 

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-06-02