-3

I Am Trying To use this api from https://www.fembed.com/api#transfer-video can some one please give a full exaple of how to use it using php, i dot know how to use curl -X POST.

-d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET"
-d "links=JSON_ENCODED_ARRAY"
-H "Content-Type: application/x-www-form-urlencoded"```

can someone help me and give me an example please
hi hey
  • 7
  • 4

2 Answers2

2

You have to set using php-curl

php-curl-manual

Here is parameters:

curl parameters

With your data do this curl:

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, 'http://url-to-send-post'); 
curl_setopt($ch, CURLOPT_HEADER, TRUE); 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"client_id=ClIENT_ID&client_secret=ClIENT_SECRET&file_id=IdOfVideo&title=NEW_TITLE");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 

$data = curl_exec($ch); 
curl_close($ch);

var_dump($data);//response data
miglio
  • 1,978
  • 7
  • 20
  • can you help me how to use this api using php https://www.fembed.com/api#download-video – hi hey Jun 26 '19 at 21:41
  • client_id is not urlencoded, client_secret is not url-encoded, file_id is not urlencoded, title is not urlencoded, do it properly: http://paste.debian.net/plain/1089449 (without proper urlencoding, the code will malfunction if the title contains special characters like `&` or `=`) – hanshenrik Jun 27 '19 at 07:56
  • 1
    Can you give me an example from the site https://www.fembed.com/api#download-video please – hi hey Jul 01 '19 at 03:39
0

-X is CURLOPT_CUSTOMREQUEST (but when using POST in particular, don't use CURLOPT_CUSTOMREQUEST, use CURLOPT_POST instead) and -d is CURLOPT_POSTFIELDS and -H is CURLOPT_HTTPHEADER, as for examples, see the curl_setopt() documentation page at https://www.php.net/manual/en/function.curl-setopt.php

hanshenrik
  • 15,263
  • 3
  • 28
  • 61
  • can you help me how to use this api using php fembed.com/api#download-video – hi hey Jun 26 '19 at 21:42
  • @hihey in what way? which part of that api do you need help with? – hanshenrik Jun 26 '19 at 23:02
  • curl -X POST https://www.fembed.com/api/download -d "client_id=ClIENT_ID&client_secret=ClIENT_SECRET" -d "links=JSON_ENCODED_ARRAY" -H "Content-Type: application/x-www-form-urlencoded" Here how can i use it using php – hi hey Jun 27 '19 at 05:03