Skip to content

Instantly share code, notes, and snippets.

@JacobHsu
Last active June 8, 2017 14:57
Show Gist options
  • Save JacobHsu/518f7d870a453415a722 to your computer and use it in GitHub Desktop.
Save JacobHsu/518f7d870a453415a722 to your computer and use it in GitHub Desktop.
PHP curl POST #PHP
<?php
$fileUrl = 'https://googledrive.com/host/0B8p3dPzRohcndXRaNm1OamFXUUE';
$postArr = array(
"fileurl"=>$fileUrl,"btype"=> '360p,720p',
"recipient"=>'http://php/httpreq/jsonrep.php'
);
$options = array(
CURLOPT_POSTFIELDS => http_build_query($postArr),
CURLOPT_RETURNTRANSFER=>true //This will make curl_exec return the data instead of outputting
);
$ch = curl_init( 'http://127.0.0.1:8080/post');
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
curl_close($ch);
echo 'result='.$result;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment