Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    H3X
    H3X is offline
    New Coder
    Join Date
    Nov 2008
    Posts
    90
    Thanks
    30
    Thanked 0 Times in 0 Posts

    cURL Not Submitting Properly?

    I am using this code:
    Code:
    <?php
    $post = array();
    $post["Sentence"] = "the dog jumped over the lazy sheep";
    $post["Constituents"] = "checked";
    $post["NullLinks"] = "checked";
    $post["AllLinkages"] = "checked";
    $post["LinkDisplay"] = "on";
    $post["ShortLength"] = "6";
    $post["PageFile"] = "/docs/submit-sentence-4.html";
    $post["InputFile"] = "/scripts/input-to-parser";
    $post["Maintainer"] = "sleator@cs.cmu.edu";
    $post["submit"] = "Submit one sentence";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,"http://www.link.cs.cmu.edu/cgi-bin/link/construct-page-4.cgi#submit");
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.16) Firefox/2.0.0");
    curl_setopt($ch, CURLOPT_REFERER, "http://link.cs.cmu.edu/link/submit-sentence-4.html");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    $results = curl_exec($ch);
    curl_close($ch);
    echo $results;
    ?>
    And trying to fetch the page that would contain the results. I instead, however, get a page that takes about 20 seconds to load that contains an error message. I have no idea what I'm doing wrong, and I have tried nearly everything. The page with the original form on it is: http://www.link.cs.cmu.edu/link/submit-sentence-4.html. When I just copy and paste the form their page to my page, then submit it manually, it works fine.
    Thanks.
    Last edited by H3X; 08-25-2009 at 09:58 PM.

  • #2
    New Coder
    Join Date
    Aug 2009
    Posts
    26
    Thanks
    1
    Thanked 3 Times in 3 Posts
    i think you should use urlencode to endoce them and use urldecode to decode and use them in your destination php script. This ensures sending of variable values accurately over pages...

  • Users who have thanked tailender1 for this post:

    H3X (08-25-2009)

  • #3
    H3X
    H3X is offline
    New Coder
    Join Date
    Nov 2008
    Posts
    90
    Thanks
    30
    Thanked 0 Times in 0 Posts
    Just tried that, it doesn't help. Thanks though.

  • #4
    H3X
    H3X is offline
    New Coder
    Join Date
    Nov 2008
    Posts
    90
    Thanks
    30
    Thanked 0 Times in 0 Posts
    This fixed it:
    Code:
    $post = http_build_query($post);


  •  

    Posting Permissions

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