Autor Zpráva
gardener
Profil
Zdravim,
snazim se odeslat na formular Vodafonu dta z meho formulare pomoci curl, bohuzel se stale nedari mi to zprovoznit..kdyz jsem zkousel odesilat nejaka dta na localhostu, tak to fungovalo, zde je asi problem jeste v necem jinem(cookies?)

Vystu z Curl_get info je tento>
Array
(
    [url] => http://www.vodafonesms.cz/send.php
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => 0
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0
    [namelookup_time] => 0
    [connect_time] => 0
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 0
    [redirect_time] => 0
)


Tzn. nic se nedeje..

Netusi nekdo prosim v cem by mohl byt problem, popripade, jak ho vyresit..?
Snazil jsem se hledat informace vsude mozne ale zrovana o curl a neni nikde moc dobrych clanku..

Kod aplikace:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Author" content="" />
<title>SMS_sender_VF</title>
</head>

<body>
<?php
//START Nacitani captcha kodu a vkladani do formu
$website="http://www.vodafonesms.cz/";
$obsah=file_get_contents("$website","r");
//Regularni vyraz pro skite pole ze ktereho bereme ID pro obrazek, jelikoz jsou shodna
if(preg_match("<input type=\"hidden\" name=\"imgid\" value=\".*\" />",$obsah,$nalezene))
echo("Zaznam nalezen<br/>");
else
{echo("Zaznam nenalezen");}
//Orizneme na 32 znaku tj.delka id kodu
$kod=(substr($nalezene[0],40,32));
//Nacteme obrazek(Vypisuji ho nyni pod formem)
//END Nacitani captcha kodu a vkladani do formu

if(!empty($_POST)){

//Skryty imageid input
$kod=$kod;
//cislo prijemnce
$prijemce = ($_POST["number"]) ;
//cislo odesilatele
$odesilatel = ($_POST["mynumber"]) ;
//jmeno
$jmeno_odesilatele = ($_POST["sender"]) ;
//zprava
$mess = ($_POST["message"]) ;
//Zde bude predana hodnota captchy kterou nacitam pomoci regularu
$captcha = ($_POST["pictogram"]) ;

// příklad použití
$data['number'] = ($_POST["number"]) ;
$data['mynumber'] = ($_POST["mynumber"]) ;
$data['sender'] = ($_POST["sender"]) ;
$data['message'] = ($_POST["message"]) ;
$data['pictogram'] = ($_POST["pictogram"]) ;


//ZACATEK CURL REQUESTU
// HTTT POST
function postit(&$data,$url,$verbose){
 $s="";
 foreach($data as $key=>$val) {
   if (!empty($s)) $s.= '&';
   $s.= $key.'='.urlencode($val);
 }
 // init
 $ch = curl_init($url);
 // set options
 curl_setopt($ch, CURLOPT_HTTP_VERSION, 1.0);
 curl_setopt($ch, CURLOPT_VERBOSE, $verbose);
 curl_setopt($ch, CURLOPT_HEADER, 1);
 curl_setopt($ch, CURLOPT_TIMEOUT, 100);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $s);
 // perform post
 $rr=curl_exec($ch);
 if ($verbose) echo $rr;
echo "<pre>", print_r(curl_getinfo($ch), true), "</pre>";
curl_close($ch);
 }

postit($data,'http://vase.vodafonesms.cz/send.php',1);
}
?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data" >
<fieldset>
<label for="number">Cislo prijemce:</label><br/>
<input name="number" type="text" value="777915155" name="number" /><br/>
<label for="mynumber">Vase cislo:</label><br/>
<input name="mynumber" type="text" value="777777777" name="mynumber" /><br/>
<label for="sender">Vase jmeno:</label><br/>
<input name="sender" type="text" value="Jirka" name="sender" /><br/>
</fieldset>
<fieldset>
<label for="message">Zprava:</label><br/>
<textarea wrap="OFF" maxlength="160" name="message"  id="message">Hello world</textarea><br/>

<?php echo("<img src=\"$website/imgcode.php?id=$kod\" alt=\"Číselný kód\" />"); ?><br/>
<label for="sender">Opiste Captchu:</label><br/>
<input name="pictogram" type="text" value="" name="pictogram" /><br/>
<input  type="submit" name="submit" value="Posli" />
</fieldset>
</form>
</body>
</html>




Diky moc za kazdou radu...
gardener
Profil
Jeste jsem zkusil dat parametry primo tak ze jsem si je vytahl z post a zmenil na get(viz, miniscript nize, kde se opisuje jen captcha)..ale ani to bohuzel nejede..a to uz jsem myslel, ze mam vyhrano..

<?php
        //START Nacitani captcha kodu a vkladani do formu
        $website = "http://www.vodafonesms.cz/";
        $obsah = file_get_contents("$website", "r");
        //Regularni vyraz pro skite pole ze ktereho bereme ID pro obrazek, jelikoz jsou shodna
        if (preg_match("<input type=\"hidden\" name=\"imgid\" value=\".*\" />", $obsah, $nalezene_imgid))
            echo("id_captchy nalezeno<br/>");
        else {
            echo("id_captchy nenalezeno");
        }
        if (preg_match("<input type=\"hidden\" name=\"ppp\" value=\".*\" />", $obsah, $nalezene_ppp))
            echo("id_ppp nalezeno<br/>");
        else {
            echo("id_ppp nenalezeno");
        }
        //Orizneme na 32 znaku tj.delka id kodu
        $id_captcha = (substr($nalezene_imgid[0], 40, 32));
        $id_ppp = (substr($nalezene_ppp[0], 38, 48));
        //Nacteme obrazek(Vypisuji ho nyni pod formem)
        //END Nacitani captcha kodu a vkladani do formu

   // příklad použití
   if(isset($_POST["pictogram"]))
{         
            $locale = "cz";
            $number = "758915155";
            $mynumber ="759925155";
            $sender = "Jirka";
            $message = "Hello world";
            $pictogram = ($_POST["pictogram"]);
            $data['send'] = "Odeslat!";

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://vase.vodafonesms.cz/send.php");
curl_setopt($curl, CURLOPT_POST, 1);
//http://www.vodafonesms.cz/send.php?imgid=43e3cfcb6894d4ef42e9fc72a4de6e4d&ppp=125336053127534%3A644f22587cc676c6420a71a9fe4a2e44&locale=cz&number=724915155&mynumber=777777777&sender=Jirka&message=Hello+world&char_in=11&char_le=739&parts=1&pictogram=3637&send=Odeslat!
curl_setopt($curl, CURLOPT_POSTFIELDS, "imgid=$id_captcha&ppp=$id_ppp&locale=$locale&number=$number&mynumber=$mynumber&sender=$sender&message=$message&char_in=11&char_le=739&parts=1&pictogram=$pictogram&send=Odeslat!");

curl_exec($curl);
echo "<pre>", print_r(curl_getinfo($curl), true), "</pre>";
curl_close($curl);
}

?>
     <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
      
                <?php echo("<img src=\"$website/imgcode.php?id=$id_captcha\" alt=\"Číselný kód\" />"); ?>
                <br/>
                <?php echo("$id_ppp"); ?>
                <br/>
                <label for="sender">
                    Opiste Captchu:
                </label>
                <br/>
                <input name="pictogram" type="text" value="" name="pictogram" />
                <br/>
                <input type="submit" name="send" value="Odeslat!" />
            </fieldset>
        </form>

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: