Jump to content

cURL script na automatickou regeneraci nahledu (pomoc)


blacksymmetry
 Share

Recommended Posts

Ahoj vsem,
chci si napsat jednoduchy cURL script ktery mi odesle formular slouzici pro generovani miniatur obrazku, tak abych ho mohl spoustet cronem.
Prevedl jsem si pole formu z POST na GET, vytahl hodnoty a posilam je jako POST form.
Bohuzel ale je asi neco spatne i presto, ze jsem pouzil a vyplnil skryta pole token ve formulari a dalsi,vytvareni nahledu se takto nespusti.

Zadna chybna hlaska, v cem by mohla byt chyba?

Diky za kazdou radu, hledal jsem vsude, resi to vice lidi ale nikdo jeste s uspesne nahlasenym vysledkem.

<?php
$url = "http://shop.loc/administrator/index.php?tab=AdminImages&token=a812bf10d6691ee8f04b66af7c55dead"; // URL to POST FORM.
$post_fields ='token=a812bf10d6691ee8f04b66af7c55dead&type=all&erase=1&submitRegenerateimage_type=Regenerovat+miniatury'; //
//form Fields.
$ch = curl_init(); // Initialize a CURL session.
curl_setopt($ch, CURLOPT_URL, $url); // Pass URL as parameter.
curl_setopt($ch, CURLOPT_POST, 1); // use this option to Post a form
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); // Pass form Fields.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return Page contents.
$result = curl_exec($ch); // grab URL and pass it to the variable.
//curl_close($ch); // close curl resource, and free up system resources.
echo $result; // Print page contents.
?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More