my old code is using xml and json is like this need to update this to latest 3D Secure v2.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://epage.payandshop.com/epage-remote.cgi");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "payandshop.com php version 0.9");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line makes it work under https
$response = curl_exec ($ch);
curl_close ($ch);
There is a form and i am getting $_POST data.
The code is this
if (isset($_POST) && $_POST) {
$fields = $_POST;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://example.org/index.php/public/example/SaveExample");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
$output = curl_exec($ch);
}
But the call to controller is not working.what will be the issue.anybody pls help
I have created a script that fetches all the articles from https://insuredhq.atlassian.net/ below is the code I have used.
$username = '##########';
$password = '##########';
$url = "https://insuredhq.atlassian.net/wiki/rest/api/content?spaceKey=IUM&id=Completing%20a%20Task&expand=space,body.view,version,container";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$result = curl_exec($ch);
curl_close($ch);//print_r($result);
$result = json_decode($result);
echo "<pre>";
print_r($result);
I have checked those image src property and they are dynamic urls like /wiki/download/attachments/13303822/Dashboard.png?version=1&modificationDate=1462935137147&api=v2 and even I change them to static urls like https://insuredhq.atlassian.net/wiki/download/attachments/13303822/Dashboard.png?version=1&modificationDate=1462935137147&api=v2 but still they are not being displayed.
For detailed example please check this link http://hunaniinfotech.com/insecuredhq/article.php?id=13303841
I have been around this site looking for solution to my question, some answers look close but not as much to find the solution to my issue
I have PHP curl to login to certain site and redirect to certain link while logged in.
***First to log:***
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https >somesite');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $uagent);
curl_setopt($ch, CURLOPT_REFERER, 'some other site');
curl_setopt($ch, CURLOPT_TIMEOUT, 220);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).DS.'cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).DS.'cookies.txt');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,'userid='.$log.'&password='.$pass.);
$content = curl_exec( $ch )
***then run this to get away from page with ads ***
$info = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$fnd='ads'; ***// check to see if has ads***
$pos=strpos($info, $fnd);
if ($pos!==false)
{
$url1 = "https - link to redirect while logged id"; // ***I have this link for sure***
$ch1 = curl_init();
curl_setopt ($ch1, CURLOPT_URL, $url1);
curl_setopt ($ch1, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch1, CURLOPT_USERAGENT, $uagent);
curl_setopt( $ch1, CURLOPT_HEADER, 1);
curl_setopt ($ch1, CURLOPT_COOKIESESSION, 0);
curl_setopt ($ch1, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch1, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch1, CURLOPT_CONNECTTIMEOUT ,100);
curl_setopt ($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch1, CURLOPT_COOKIEJAR, dirname(__FILE__).DS.'cookies.txt');
curl_setopt ($ch1, CURLOPT_COOKIEFILE, dirname(__FILE__).DS.'cookies.txt');
curl_setopt ($ch1, CURLOPT_POST, 0);
$content = curl_exec ($ch1);
but that is not working.
Who would kindly answer me?
Thank you.
I heard a dialog in a horror movie(not sure though) long time back "Easy Pizzy, that means crazy". Solution of your problem is easy, but not until you know it :-)
Close your curl to make sure it saves the cookies into the file. Otherwise its always empty and hence not working on second call.
// use it before second curl call
curl_close($ch);
In fact its always a good practice to close the curl instance after the needs are done!
If I use the Facebook API to publish a photo to a page they appear as single story.
$args = array(
'message' => '',
);
$args["picture"] = '#' . realpath($file);
$ch = curl_init();
$url = 'https://graph.facebook.com/me/photos?access_token='.$token;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);
If I publish from Facebook they appear correctly as a single story for each picture.
How to do this programmatically?