Account


Earned badges

Achievement: Latest Unlocked

Topic Started

Topics
Hello! I seem to be getting a 500 when I try to upload a new document.

Replies Created

0 votes
Hey Haris, At this point, we've had 2 dev's get stuck on taking the postman instance, and turn it into a php script. We are having a lot of difficulty and not sure where to go. Could you help point us in the right direction? Server throwing a 500
 '@' . $file_name_with_full_path);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Authorization: Basic MY_API_KEY",
    "Accept: text/html",
    "content-type: multipart/form-data;"
));
$result = curl_exec($ch);
curl_close($ch);

0 votes
Thanks for your reply! I tried it out, it uploads a PDF, but something strange happens. When I viewed the uploaded PDF, the content is just a string showing @+ $documentPath I've tried fiddling with it a little, can't figure it out Response = {"status":"","id":"app","signedHash":null,"extract":false,"approvals":[],"pages":[{"id":"","top":0.0,"height":1030.0,"left":0.0,"width":796.0,"index":0,"version":0}],"external":null,"data":null,"index":1,"fields":[],"description":"","name":"Sample NDA","size":31132}

0 votes
Many thanks! I got it to work with the following code
 $documentJSON,
			"file"=> $document
		);

		$headerOptions = array(
		    'Authorization: Basic ' . $ESIGNLIVE_AUTH_KEY
		);
		if(!is_null($contentType))
		{
			$headerOptions[] = "Content-Type: $contentType";
		}
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_POST, true);
		curl_setopt($ch, CURLOPT_FAILONERROR, true);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

		if(!is_null($postfields))
		{
			curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
			if(!is_array($postfields))
			{
				$headerOptions[] = 'Content-Length: ' . strlen($postfields);
			}
		}

		curl_setopt($ch, CURLOPT_HTTPHEADER, $headerOptions);

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

		echo $response;
		
?>

Subscriptions

Topics Replies Freshness Views Users
Hello! I seem to be getting a 500 when I try to upload a new document.
12 7 years 6 months ago 4,209
Profile picture for user harishaidary

Code Share

This user has not submitted any code shares.

Subscriptions Release Notes

This user is not subscribed to any release notes.