php remote client url encoding issue
Posted: Fri Mar 26, 2010 11:59 am
i was just trying to put the webservice.php to use and found that it didn't work correctly without adding a urldecode to line 78:
require_once('./TeraWurflWebservice.php');
$userAgent = urldecode($_REQUEST['ua']);
$searchPhrase = $_REQUEST['search'];
It was only matching generic devices in recovery matches instead of matching exact as it does when not using the web service or when adding the urldecode().
It works correctly without when entering the webservice uri directly in the browser, but when using the TeraWurflRemoteClient.php it doesn't work. I noticed this line which urlencodes the userAgent:
$uri = $this->webserviceUrl . (strpos($this->webserviceUrl,'?')===false?'?':'&')
. 'ua=' . urlencode($this->userAgent)
. '&search=' . implode('|',$capabilities);
Adding this would likely effect the functionality of the other remote clients, but I didn't check.
require_once('./TeraWurflWebservice.php');
$userAgent = urldecode($_REQUEST['ua']);
$searchPhrase = $_REQUEST['search'];
It was only matching generic devices in recovery matches instead of matching exact as it does when not using the web service or when adding the urldecode().
It works correctly without when entering the webservice uri directly in the browser, but when using the TeraWurflRemoteClient.php it doesn't work. I noticed this line which urlencodes the userAgent:
$uri = $this->webserviceUrl . (strpos($this->webserviceUrl,'?')===false?'?':'&')
. 'ua=' . urlencode($this->userAgent)
. '&search=' . implode('|',$capabilities);
Adding this would likely effect the functionality of the other remote clients, but I didn't check.