Note that there are some explanatory texts on larger screens.

plurals
  1. POPotential issue with ssl in php script
    primarykey
    data
    text
    <p>I've created a script in php that is used to capture the properties for users. </p> <p>In order to do so, it requires calling the api to obtain those properties.</p> <p>The url I set is:</p> <pre><code> $url=("http://user:pass@oursite.com/@api/users/=$user_id/properties"); </code></pre> <p>Then use file_get_contents for the xml.</p> <p>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? </p> <p>Code:</p> <pre><code>&lt;?php $user=$_GET['userid']; $user_id=str_replace(array('@', '#'), array('%40', '%23'), $user); print "User-id: $user"; print "&lt;br /&gt;&lt;br /&gt;"; $url=("http://user:admin@oursite.com/@api/users/=$user_id/properties"); echo $url; $xmlString=file_get_contents($url); $delete = "http://user:admin@oursite.com/@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 "&lt;br /&gt;"; if(!count($xml-&gt;property)) die('No properties exist for this user'); foreach($xml-&gt;property as $property) { $name = $property['name']; $name2=str_replace(array('@', '#'), array('%40', '%23'), $name); print $name2; print "&lt;br /&gt;"; curl_fetch($delete . $name2,'user','pass'); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload