Potential issue with ssl in php script

Huckster

New Member
I've created a script in php that is used to capture the properties for users. In order to do so, it requires calling the api to obtain those properties.The url I set is:\[code\] $url=("http://user:p[email protected]/@api/users/=$user_id/properties");\[/code\]Then use file_get_contents for the xml.When I simply type this url into the browser it works fine. It immediately output those properties for the given user. However it looks as if it automatically switches it to https. Is there something that needs to be done so this can work when using php? Code:\[code\]<?php$user=$_GET['userid'];$user_id=str_replace(array('@', '#'), array('%40', '%23'), $user);print "User-id: $user";print "<br /><br />";$url=("http://user:[email protected]/@api/users/=$user_id/properties");echo $url;$xmlString=file_get_contents($url);$delete = "http://user:[email protected]/@api/users/=$user_id/properties/";$xml = new SimpleXMLElement($xmlString);function curl_fetch($url,$username,$password,$method='DELETE'){ $ch = curl_init(); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch,CURLOPT_USERPWD,"$username:$password"); return curl_exec($ch);}print "The following properties have been removed: ";print "<br />";if(!count($xml->property)) die('No properties exist for this user');foreach($xml->property as $property) { $name = $property['name']; $name2=str_replace(array('@', '#'), array('%40', '%23'), $name); print $name2; print "<br />"; curl_fetch($delete . $name2,'user','pass');}\[/code\]
 
Back
Top