PHP/cURL need help...post data affiliate link cloaking :)

Discussion in 'PHP' started by JoelJonathan, Dec 18, 2006.

  1. #1
    I originally posted this here:

    Mad4 has the right idea I believe:

    I know am to the point where I have the www.mysite.com/QuoteHome.php page looking like this:

    <?
    $zip = $_REQUEST["zip"];
    $URL="www.affiliatelandingpageoffer.com";
    $ch = curl_init();   
    curl_setopt($ch, CURLOPT_URL,"https://$URL"); 
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "Refby=affiliateIDHere&Type=Health&zip=Zip%20Code");curl_exec ($ch);    
    curl_close ($ch);
    ?> 
    PHP:
    However, this behaves weirdly in that it takes info from the affiliate landing page and brings it over onto my site onto the QuoteHome.php page and shows weird error messages.

    Ideas?
     
    JoelJonathan, Dec 18, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How is that weird? That's exactly what yuor code does. It takes the landing page and brings it to your page. The error might come because you harcocded a non-valid zip code in the URL.
     
    T0PS3O, Dec 18, 2006 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Are they errors from php, lets have them and the lines of code above and below the lines mentioned in the error <5 lines>
     
    krakjoe, Dec 18, 2006 IP
  4. JoelJonathan

    JoelJonathan Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Sorry for my ignorance in PHP - I think I probably just have everything set up backwards then. My goal is to have:

    1 Affiliate quote box offer on index page

    linking to (rel=nofollow)

    2 QuoteHome.php page on my site (no index, no follow in headers and robots.txt) acting as a conduit page to automatically post data from index page and then on to affiliate landing page
     
    JoelJonathan, Dec 18, 2006 IP
  5. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #5
    okay then, post all of the QuoteHome.php and we'll see if it does do that and if not why not .....
     
    krakjoe, Dec 18, 2006 IP
  6. JoelJonathan

    JoelJonathan Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <?
    $zip = $_REQUEST["zip"];
    $URL="www.insureme.com/Landing.aspx";
    $ch = curl_init();   
    curl_setopt($ch, CURLOPT_URL,"https://$URL"); 
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "Refby=613786&Type=Health&zip=Zip%20Code");curl_exec ($ch);    
    curl_close ($ch);
    ?> 
    PHP:
     
    JoelJonathan, Dec 18, 2006 IP
  7. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Unless I'm misunderstanding your aims I don't think curl is the solution. You can't (as far as I am aware) set up a session in php with curl and then hand it over to a visitors browser.

    If you copy their form code over onto your page it should still submit correctly, then all you need to do is use meta tags/robots.txt to prevent the search engines from indexing the page.
     
    streety, Dec 18, 2006 IP
  8. JoelJonathan

    JoelJonathan Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I think I am getting somewhere now. On the QuoteHome.php page I now have the affiliate code as well as this php:

    <?
    $zip = $_REQUEST["zip"];
    ?>
    PHP:
    as well as this for the value:

    value=
    <? print "$zip"?>
    PHP:
    This now gives me my conduit page. However, a submit button still needs to be pressed on the QuoteHome.php page (for the second time) to then post the data onto the affiliate site.

    It seems that all I need is a little script to submit the button automatically as soon as the page loads. I have tried a few things but still havent found the right thing....
     
    JoelJonathan, Dec 18, 2006 IP
  9. JoelJonathan

    JoelJonathan Peon

    Messages:
    152
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Got it! - Thanks everyone for the help!
     
    JoelJonathan, Dec 18, 2006 IP