Connection String of Windows Azure in php -
i have such connection statement connect blob storage i've created in windows azure.
$connectionstring = 'defaultendpointsprotocol=http;accountname=<accountname>;accountkey=<secret key>'; $echo "1"; $blobrestproxy = servicesbuilder::getinstance()->createblobservice($connectionstring); $echo "2";
when put this, "1" written, "2" isn't.
does mean, $blobrestproxy isn't working?
i try create container in blob storage, fails.
how can fix problem?
thanks.
updates:
this link picture shows inside of public_html
http://picpaste.com/2-fjxf4kpo.jpg
these links of picture shows inside of website folder
http://picpaste.com/3-crea0e72.jpg
http://picpaste.com/4-tjvv3br7.jpg
<!doctype html> <html lang="en"> <head> <title>more</title> <meta charset="utf-8"> <meta name="description" content="description goes here"> <meta name="keywords" content="keywords goes here"> <!--<link rel="stylesheet" href="css/style.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/preview.css" type="text/css"> <script type="text/javascript" src="js/main.js"></script>--> <!--[if lt ie 8]> <div style=' clear: both; text-align:center; position: relative;z-index:100;'> <a href="http://windows.microsoft.com/en-us/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="you using outdated browser. faster, safer browsing experience, upgrade free today." /></a> </div> <![endif]--> </head> <body> <div id="wrapper"> <section> <div class="dynamiccontent"> <!--content --> <?php $server = "tcp:t656iqht6v.database.windows.net,1433"; $user = "saitarslanboun@t656iqht6v"; $pwd = "uj8pfof4"; $db = "misbounstashnew_db"; $conn = sqlsrv_connect($server, array("uid"=>$user, "pwd"=>$pwd, "database"=>$db)); if($conn === false){ die(print_r(sqlsrv_errors())); } ?> <?php echo '<h3>'.$_get['course'].'</h3>'; ?> <?php echo "1"; require_once 'windowsazure.php'; echo "2"; use windowsazure\common\servicesbuilder; echo "3"; use windowsazure\blob\models\createcontaineroptions; echo "4"; use windowsazure\blob\models\publicaccesstype; echo "5"; use windowsazure\common\serviceexception; echo "6"; $connectionstring = 'defaultendpointsprotocol=http;accountname=misbounstashnew;accountkey=o5uc6pxyuultbg4motunrzvqw0yzzcp90yyjunjoue8pt2rx8eiez/ze1dnqmdsv1ouvp35qph5tjmcnibya3a=='; echo "7"; $blobrestproxy = servicesbuilder::getinstance()->createblobservice($connectionstring); echo "8"; if ($blobrestproxy) {echo "success_blobrestproxy";} if (!$blobrestproxy) {echo "fail_blobrestproxy";} $createcontaineroptions = new createcontaineroptions(); try { // create container. $blobrestproxy->createcontainer("mycontainer", $createcontaineroptions); } catch(serviceexception $e) { // handle exception based on error codes , messages. // error codes , messages here: // http://msdn.microsoft.com/en-us/library/windowsazure/dd179439.aspx $code = $e->getcode(); $error_message = $e->getmessage(); echo $code.": ".$error_message."<br />"; } ?> <!--content end --> </div> </section> </div> <script> $("a[rel^='prettyphoto']").prettyphoto({animation_speed:'normal',theme:'dark',social_tools:false,allow_resize: true,default_width: 500,default_height: 344}); </script> </body> </html>
from code not clear if have imported appropriate azure libraries (not sure if right terminology). tried following , worked me:
<?php require_once 'windowsazure.php'; use windowsazure\common\servicesbuilder; try { $connectionstring = 'defaultendpointsprotocol=https;accountname=account name;accountkey=account key'; echo "1"; $blobrestproxy = servicesbuilder::getinstance()->createblobservice($connectionstring); echo "2"; } catch(serviceexception $e){ // handle exception based on error codes , messages. // error codes , messages here: // http://msdn.microsoft.com/en-us/library/windowsazure/dd179446.aspx $code = $e->getcode(); $error_message = $e->getmessage(); echo $code.": ".$error_message."<br />"; } ?>
screenshot of how things on computer:
Comments
Post a Comment