• 24-12-2021, 17:20:13
    #1
    Formdaki bir veriyi post edip, curl ile gelen sonucu almak istiyorum. postfileds array ile post edeceğim veriyi elle girince curl istediğim sonucu getiriyor ancak form ile nasıl yapacağımı bulamadım. Yardımcı olabilir misiniz?

    <form action="curl.php" method="post">
    <input type="text" name="value">
    <input type="submit" name="SUBMIT">
    </form>
    <?php
    $ch = curl_init();
    $vl = $_POST["value"]
    curl_setopt_array($ch, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => 'https://www.register.com',
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => [
    'value' => "1234567890",
    'submit' => "SUBMIT"
    ],
    CURLOPT_FOLLOWLOCATION => 1,
    ));
    $resp = curl_exec($ch);
    libxml_use_internal_errors(true);
    $doc = new DOMDocument();
    $doc->loadHTML($resp);
    $xpath = new DOMXpath($doc);
    echo "<table>";
    $regs = $xpath->query('//*[@id="post"]/div/table/tbody/tr');
    foreach($regs as $reg)
    
    {
        echo "<tr>";
        $info = $xpath->query('td', $reg);
        echo "<td>" . $info->item(0)->textContent . "</td>";
        echo "<td>" . $info->item(2)->textContent . "</td>";
        echo "<td>" . $info->item(1)->textContent . "</td>";
        echo "</tr>";
    }
    echo "</table>";
    ?>
  • 24-12-2021, 17:28:23
    #2
    ajaxla yap o zaman yani curl php sayfasına gitmesin aynı sayfada sonucu versin istiyorsan