webapi_example's People
Forkers
cmonsalve yihad ariessanchezsulit zzzzkidd kurtzilla ruslanchyk chinmayongit pablogm95 vikkupandit jshi-git npezzoli calamar112 mezzomaniac jpmendenhall carlosriosg chetantete jesusninoc fabiobaser wangstoudamire mgagnon555 crystalco nkoranga vinyllicker maximo125ac gitycheng ahvin2020 nayibor cc8848 njh hshy alxxmoy githubliuming eduardpoche gbateman-vtn masanarih0ri yaningxu majdlatah stevelagarto koderisch damilolaalao neilrackett polin4ikk internetmusic zlc2019 armenzoom hough-lab dacosta16 javapa pofi5000webapi_example's Issues
Internal Server Error php
Hi,
I am trying to upload audio file using php I got this
` HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Server: openresty/1.9.7.4
< Date: Mon, 23 Jan 2017 16:51:29 GMT
< Content-Type: application/json; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.6.21
< X-Rate-Limit-Limit: 600
< X-Rate-Limit-Remaining: 599
< X-Rate-Limit-Reset: 0
* HTTP error before end of send, stop sending
<
* Closing connection 0`
my code
`$request_url = 'https://api.acrcloud.com/v1/audios';
$http_method = 'POST';
$http_uri = '/v1/audios';
$timestamp = time();
$signature_version = '1';
$account_access_key = '*****************';
$account_access_secret = '********************';
$string_to_sign =
$http_method . "\n" .
$http_uri . "\n" .
$account_access_key . "\n" .
$signature_version . "\n" .
$timestamp;
$signature = base64_encode(hash_hmac("sha1", $string_to_sign, $account_access_secret, true));
$realpath = realpath('uploads/********.mp3');
if(class_exists('\CURLFile'))
$cfile = new \CURLFile($realpath, "audio/mp3", basename($realpath));
else
$cfile = '@' . $realpath;
$fields = array(
'audio_id' => '30007',
'title' => 'aya number 19',
'audio_file' => $cfile,
'bucket_name' => 'whatever',
'data_type' => 'audio', // if you upload fingerprint file please set 'data_type'=>'fingerprint'
'custom_key[0]' => 'track_id',
);
$headerArray = array();
$headers = array(
'access-key' => $account_access_key,
'signature' => $signature,
'signature-version' => '1',
'timestamp' => $timestamp,
);
foreach( $headers as $n => $v ) {
$headerArr[] = $n .':' . $v;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_VERBOSE, true);
$verbose = fopen('php://temp', 'w+');
curl_setopt($ch, CURLOPT_STDERR, $verbose);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArr);
$result = curl_exec($ch);
if ($result === FALSE) {
printf("cUrl error (#%d): %s<br>\n", curl_errno($ch),
htmlspecialchars(curl_error($ch)));
}
rewind($verbose);
$verboseLog = stream_get_contents($verbose);
echo "Verbose information:\n<pre>", htmlspecialchars($verboseLog), "</pre>\n";
dd($result);
curl_close($ch);`
Any help will be appreciated thank you
timestamp = time.time()
header verification from request no longer accepts integers, needs to be string.
I made this work by adding str(time.time()) for the variable definition.
(401) Unauthorized
Hi, I'm using free trial account to use "UploadAudios.cs" sample and get this error:
The remote server returned an error: (401) Unauthorized
upload_audio
{
"name": "Unprocessable entity",
"message": "Lack field:title",
"code": 0,
"status": 422
}
when upload_audio
for upload_audio.php
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.