cURL POST doesn't work on <form action="other_page.php">

Discussion in 'PHP' started by BMABMA, Aug 7, 2010.

  1. #1
    Hi,

    I've used cURL for a long time, and submitting a POST form is a very basic use with curl. But, this time it didn't work and the only difference with the other ones is that this form (wich is by the way a very basic html form) doesn't send the data to the same page's header but sends it to another page like that :
    <form name="someform "action="other_page.php">
    Code (markup):
    So what should I do to have the content of "other_page.php" after posting the data to the main page?

    Thank you for any help.
     
    BMABMA, Aug 7, 2010 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    curl_setopt($ch, CURLOPT_URL, 'http://....other_page.php');
    
    PHP:
    ...?

    Or CURLOPT_FOLLOWLOCATION if the form redirects to another page after submitting the form.
     
    nico_swd, Aug 7, 2010 IP
  3. BMABMA

    BMABMA Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    I've already tried these two options before and always nothing (for FOLLOWLOCATION I get the error of safe mode and it didn't work even when I disactivated it from my serv).
     
    BMABMA, Aug 7, 2010 IP
  4. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #4
    Set the URL as the action ie..
    curl_setopt($ch, CURLOPT_URL, 'http://domain.com/other_page.php');
    PHP:
    That should work, just make sure the the action is proceeded by the websites host/domain...(including any subdirectories)
     
    danx10, Aug 8, 2010 IP
  5. BMABMA

    BMABMA Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Thank you all.

    The "http://domain.com" is mine so I just made a custom non-public php page just for the curl use with direct posting with action on the same page and it works.
     
    BMABMA, Aug 8, 2010 IP