Log in or register to post comments

Problem with vws and php using fsockopen

January 30, 2013 - 7:10am #1

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:

 

opened
GET /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

January 31, 2013 - 1:58am #4

Hi Ursula,

the explanation is simple:

the /summary function is not available at the moment, but I received confirmation today that it will be enabled in the next udpate of the VWS; this is expected relatively soon (cannot confirm exact date at the moment, but bear with us..)

 

Problem with vws and php using fsockopen

January 31, 2013 - 1:44am #3

HI!

Thx for ur reply Alessandro.

I read the posts u mean. I think im doing something wrong with the vws /summary due to another vws like /targets works with no problem using my code. 

if i use the code from the other post (using curl instead of fsockopen), the vws /summary still doesn't work .

(Maybe the vws /summary are unavailable??  Anyone could use them with php??)

 

Those services are almost identical :(

From the vuforia docs:

 

Database Summary Report

GET /summary  HTTP/1.1

Host: vws.vuforia.com

Date: Mon, 23 Apr 2013 12:45:19 GMT

Authorization: VWS df8d23140eb443505c0661c5b58294ef472baf64:jHX6oLeqTXpynyqcvVC2MSHarhU

 

Listing Targets in a Cloud Database

GET /targets HTTP/1.1

Host: vws.vuforia.com

Date: Mon, 23 Apr 2013 12:45:19 GMT

Authorization: VWS df8d23140eb443505c0661c5b58294ef472baf64:jHX6oLeqTXpynyqcvVC2MSHarhU

Problem with vws and php using fsockopen

January 30, 2013 - 7:32am #2

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) ?

(see 

https://developer.vuforia.com/resources/dev-guide/managing-targets-cloud-database-using-developer-api )

Log in or register to post comments