HI, im trying to connect with vws using php with the fsockopen function.
Here is the code:
$fp = fsockopen("tls://vws.vuforia.com", 443, $errno, $errstr,30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { echo "opened<br/>"; $out = "GET /summary HTTP/1.1\r\n"; $out .= "Host: vws.vuforia.com\r\n"; $date = gmdate(DATE_RFC1123); $date = substr_replace($date, 'GMT', 26); $out .= "Date: ".$date."\r\n"; $autorizationString = "Authorization: VWS ".$AccessKey.":".getSignature("/summary" , "GET", ""); $out .= $autorizationString."\r\n"; $out .= "Connection: Close\r\n\r\n"; echo $out."<br/>"; $writedone = fwrite($fp, $out); if($writedone == false) { echo 'error fwrite'; } else { echo $writedone .' bytes written <br/>'; } $data = ""; while(!feof($fp)){ $data .= fread($fp, 1024); } echo 'Data received: '.$data .'<br/>'; fclose($fp);
}
Im getting:
openedGET /summary HTTP/1.1 Host: vws.vuforia.com Date: Wed, 30 Jan 2013 14:53:26 GMT Authorization: VWS 88eff04e37ba782d21d78c8c004b6a3263477a94:ZmJkYjFkMWIxOGFhNmMwODMyNGI3ZDY0YjcxZmI3NjM3MDY5MGUxZA== Connection: Close 222 bytes written Data received: HTTP/1.1 404 Not Found Server: Apache-Coyote/1.1 Content-Type: text/html;charset=utf-8 Content-Length: 952 Date: Wed, 30 Jan 2013 14:53:26 GMT Connection: close
HTTP Status 404 -type Status report
message
description The requested resource () is not available.
Apache Tomcat/6.0.35
closed
i have tried vws.vuforia.com instead of tls://vws.vuforia.com but Data Received was empty.
Maybe im missing something with host url or params or who knows... :(
Any help would be apreciated
Problem with vws and php using fsockopen
Hi Ursula,
you may want to have a look at this thread about PHP implementation of VWS API:
https://developer.vuforia.com/forum/general-discussion/vws-authorization-problem
Also, did you take a look at our Java samples (which provide a reference implementation) ?
Problem with vws and php using fsockopen
HI!
Thx for ur reply Alessandro.
Problem with vws and php using fsockopen
Hi Ursula,
the explanation is simple: