0

need help simple php script post back curl

hello,

excuse me, i wrote a code but it returns empty,
xxxxx is username
yyyyy is password

code :
<?php
$params = array(
'handlemail' => 'XXXXXXXX',
'passwd' => 'YYYYYYYY'
);

$curl = curl_init() or die(curl_error());
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);

$submitUrl = "https://www.nic.ir/Login";
curl_setopt($curl, CURLOPT_URL, $submitUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);

$result = curl_exec($curl);
echo $result;
curl_close($curl);
?>


could you help me please?
Best Regards

1 Reply
  • Hi - Is there an API available on this site that accepts POST parameters to auto-login to the site by calling the URL you have posted? If there is could you please post a link to that API? I can look through that and see what might be happening.

    - Jon

    QUOTE (Ataomega MihanPars Administrator @ Aug 25 2009, 12:56 AM) <{POST_SNAPBACK}>
    hello,

    excuse me, i wrote a code but it returns empty,
    xxxxx is username
    yyyyy is password

    code :
    <?php
    $params = array(
    'handlemail' => 'XXXXXXXX',
    'passwd' => 'YYYYYYYY'
    );

    $curl = curl_init() or die(curl_error());
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);

    $submitUrl = "https://www.nic.ir/Login";
    curl_setopt($curl, CURLOPT_URL, $submitUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $params);

    $result = curl_exec($curl);
    echo $result;
    curl_close($curl);
    ?>


    could you help me please?
    Best Regards
    0

Recent Posts

in PHP Development