tags:

views:

54

answers:

5

Hi, i can use https to post data to apache2 server, is there any way of using https to retrieve some data from the server, running php script or something to return

Thanks

A: 

not sure what you are trying to say but you can always use this

$f=file_get_contents('https://example.com');
Christian Smorra
A: 

Just use a https GET request to retreive data.

zwip
Hi, thanks but in my php script on the server i know how to get the GET variables like this $_GET['var'];But how do i return the data as an array back to the client from my php script
tech74
That depends on what output format you want. Try print_r($array) for arrays or var_dump($object) for objects. If you want JSON output take a look at json_encode() in the PHP manual.
zwip
A: 

If your code is on the same server as the data you might not need an https connection. You can probably just read the data. If you need to use a web-API, check its documentation for how to connect over a secure connection.

Niels Bom
+1  A: 

you might want to use CURL for this (php.net manual).

a1337q
A: 

I found an example here: http://blog.taragana.com/index.php/archive/how-to-use-curl-in-php-for-authentication-and-ssl-communication/

(sorry but I couldn't post more than one hyperlink)

a1337q