How can I transform this curl command into php curl code? -


i struggle everytime need use php curl. documentation pretty bad , endup doing trial , error. how can convert console command php curl code:

curl -h "x-futuresimple-token: token" "https://appointments.futuresimple.com/api/v1/appointments.json" 

try this:

$curl = curl_init();  curl_setopt( $curl, curlopt_returntransfer, 1 ); curl_setopt( $curl, curlopt_httpheader, array( 'x-futuresimple-token: token' ) ); curl_setopt( $curl, curlopt_url, 'https://appointments.futuresimple.com/api/v1/appointments.json' );  $result = curl_exec( $curl );  if ( $result === false ) {     die( 'error fetching data: ' . curl_error( $curl ) ); }  curl_close( $curl ); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -