Results 1 to 4 of 4

Thread: Links with PHP/Curl

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Links with PHP/Curl

    I'm testing the CURL function and I'm actually doing quite well.

    I've got this:

    PHP Code:
          $curl curl_init();
           
    // The above line initializes the CURL session.

           
    curl_setopt($curlCURLOPT_URL"http://correctsite.com/cgi-bin/add_posting.pl?posting=001");
           
    // The above line tells CURL what URL we’re going to be working with. 
    And I have saved the php file to my website and when I run it the correct page (as in curl_setopt) opens with the form filled in as I want it.

    However - when I click 'submit' I get mysite.com/cgi-bin/add_posting.pl?posting=001 RATHER THAN correctsite.com/cgi-bin/add_posting.pl?posting=001

    So in other words, for some reason my own domain is being appended onto the url rather than exactly as specified. Can anyone advise how to actually correct this?

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Re: Links with PHP/Curl

    I found the problem - the page which I am fetching using CURL has a form with action="/cgi-bin/add_posting.pl"

    The problem of course is that this is relative and I need to change that to an absolute path. Is there a way I can change that bit of the form code so instead it will show the correct full absolute path?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Location
    From the UK
    Posts
    422

    Re: Links with PHP/Curl

    I'm still having trouble with this - can someone please help! I'm trying to get a page using curl, change some of its code (such as the forms action) and then submit something to it.

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Links with PHP/Curl

    for the record, I've never used or looked much into using curl. I don't know its capabilities but will try to provide some type of theory for you.

    so, you obviously can't just edit a file on the web and then submit to it, that would be such a huge security risk. what you could do is, if curl allows you to anyway, save the output you're getting for the form to a variable in your script, change the "action" parameter of the <form> to whatever you're looking for, and then save the file on your own server. then, you can submit to it. this is assuming that their script allows you to POST to it from another website, though. other than that, I have no idea how you could possibly do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width