Created
July 13, 2017 06:39
-
-
Save ManishLSN/808e2c37c9d4c6d616d1780a2d0fddbf to your computer and use it in GitHub Desktop.
curl in backgroupd by php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request = array("abc"=> $abcd, "adsf"=> $asdf, "duration" => $duration, "callback_url"=>$callBackUrl); | |
// echo "<pre>"; print_r($request); die; | |
$json = json_encode($request); | |
$ch = curl_init(HUB_MEDIA_SERVER_TEXT2VIDEO.'phpfile.php'); | |
// $ch = curl_init(HUB_MEDIA_SERVER_TEXT2VIDEO.'textToVideoDev.php'); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $json); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); | |
/*extra param for not waiting for response*/ | |
curl_setopt($ch, CURLOPT_TIMEOUT, 1); | |
// curl_setopt($ch, CURLOPT_HEADER, 0); | |
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); | |
curl_setopt($ch, CURLOPT_FORBID_REUSE, true); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1); | |
// curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 10); | |
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Content-Type: application/json', | |
'Content-Length: ' . strlen($json)) | |
); | |
// $response = curl_exec($ch); | |
curl_exec($ch); | |
// var_dump($response); die; | |
curl_close($ch); | |
// if($response === FALSE){ | |
// throw new Exception(curl_error($ch)); | |
// } | |
// $data = json_decode($response, true); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment