Could You Help me in this cURL PHP ?

Discussion in 'PHP' started by ropulos, Jun 23, 2008.

  1. #1
    I coded this php but I'm not able to see the final website corrrectly (images, links etc etc)
    can anyone help me? maybe it's a little thing:


    ---------------------------------------------------
    <?php
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, "http://www.final-url.com");
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    curl_setopt ($ch, CURLOPT_REFERER, "http://www.previous-url.com");
    curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla 2003, that coolish version");
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_exec ($ch);
    curl_close ($ch);

    ?><html><head><title>redirect</title><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"></head><body></body></html>

    ------------------------

    I can pay by paypal if you need.

    thx
     
    ropulos, Jun 23, 2008 IP
  2. King Goilio

    King Goilio Member

    Messages:
    200
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    33
    #2
    well at the moment its just getting the index page not any of the images of the css file and stuff
    I have never worked with cURL but i will have a look into fixing it
     
    King Goilio, Jun 23, 2008 IP
  3. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #3
    You're just taking the index page and you're not updating the image pointers to point to the site.

    This is most likely because the site was programmed using relative links, this means that when you copy <img src="images/image.jpg" /> it will look in YOUR domain for that image, rather than theirs.

    A solution would be use a RegEx to correct the pointers to the new domain, (preg_replace).

    Dan
     
    Danltn, Jun 23, 2008 IP