I wrote a small script, grabbing data from xml file. I need some of this xml data to generate a URL. I'm looking for a function, how to 'submit' (auto send) this generated URL. I don't use a form, the script is executed by a cron job and works 'hands-free'.
Here are some parts of my script. Thank you for your help!
<?php
$xml=simplexml_load_file("xml.xml");
// MAKE SOME VARIABLES FROM XML
$GUST = $xml->gust;
// I CAN GENERATE A WORKING LINK...
echo "<a href='http://anywhere&gust=".$GUST."&TR=T'>WORKING LINK</a>";
// BUT I I TRY TO SEND THIS GENERATED URL FROM A CRON-JOB.
//... no idea...?
You can use CURL
to post on url.
An example is here:
Passing $_POST values with cURL
$dataToPost = array('name' => 'Ross');
$handle = curl_init($urlToPostAt);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
curl_exec($handle);
Please note curl
should be enabled in your php.ini