Created
December 14, 2015 17:46
-
-
Save mariano-aguero/579ae55b5cb21064b729 to your computer and use it in GitHub Desktop.
Phonegap File Upload
This file contains hidden or 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 | |
# replace PATH_TO_BUILD, USERNAME, PASSWORD and TITLE_EXAMPLE | |
$zipname = 'PATH_TO_BUILD/build.zip'; | |
$data = ['file' => new CurlFile($zipname), | |
'data' => json_encode(['title' => 'TITLE_EXAMPLE' ,'create_method' => 'file']) | |
]; | |
$myusername = 'USERNAME'; | |
$password = 'PASSWORD'; | |
$handle = curl_init(); | |
curl_setopt($handle, CURLOPT_USERPWD, $myusername.':'.$password); | |
curl_setopt($handle, CURLOPT_URL, "https://build.phonegap.com/api/v1/apps"); | |
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($handle, CURLOPT_HTTPHEADER,['Content-type: multipart/form-data;']); | |
curl_setopt($handle, CURLOPT_POSTFIELDS, $data); | |
$response = curl_exec($handle); | |
print_r($response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment