[Solved] Post data & show source code

[ad_1] You can use 3rd parameter of this function: context $postdata = http_build_query( array( ‘var1’ => ‘some content’, ‘var2’ => ‘doh’ ) ); $opts = array( ‘http’ => array( ‘method’ => “POST”, ‘header’ => “Connection: close\r\n”. “Content-Length: “.strlen($postdata).”\r\n”, ‘content’ => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents(‘http://example.com/submit.php’, false, $context); // edit -little bug … Read more

[Solved] How to order posts by date added [closed]

[ad_1] You want to sort on the datetime (or if that doesn’t exist you could use the ID, but that is not how “it should be”) in descending order instead of ascending. Example query: SELECT `title`, `text` FROM `news` ORDER BY `datetime` DESC LIMIT 5 https://dev.mysql.com/doc/refman/5.7/en/sorting-rows.html [ad_2] solved How to order posts by date added … Read more

[Solved] Convert JSON to array in Javascript

[ad_1] You could splice the values and get only the first two elements as number. var array = [{ time: “18:00:00” }, { time: “10:00:00″ }, { time:”16:30:00” }], result = array.map(o => o.time.split(‘:’).slice(0, 2).map(Number)); console.log(result); .as-console-wrapper { max-height: 100% !important; top: 0; } If you have JSON sting, then you need to parse it … Read more

[Solved] split(‘:’,$currenttime); deprecated [duplicate]

[ad_1] From the PHP manual: Warning This function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0. Alternatives to this function include: preg_split() explode() str_split() What you want can easily be done with explode(): list($hrs,$mins,$secs,$msecs) = explode(‘:’,$currenttime); [ad_2] solved split(‘:’,$currenttime); deprecated [duplicate]

[Solved] JSON data output from database

[ad_1] You simply have to pass second params of mysqli_fetch_array to get desired result $sql = “SELECT * FROM contacts”; $result = mysqli_query($connect, $sql); $response = array(); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { //<———–change this $response[] = $row; } print json_encode($response); // Close connection mysqli_close($connect); EDIT OR you can use mysqli_fetch_assoc($result) to get associative array … Read more

[Solved] How do i make all the ‘ symbols into ” while still detecting the variables in PHP? [closed]

[ad_1] You can change the way you generate the string by breaking the it up in to the separate parts (static and dynamic) and concatenating the parts together with . textinjector($filedirectory, 23, ‘{ “title”: “.’ . $PageTitle . ‘”, “url”: “/.’ . $PageTitle . “https://stackoverflow.com/” },’); 3 [ad_2] solved How do i make all the … Read more

[Solved] Unable to upload files on Google Cloud Storage using PHP via Google Compute Engine

[ad_1] For Compute Engine vm instance to have access to Cloud Storage, follow the steps below: Go to Compute Engine Click your vm instance Check Cloud API access scopes at the very bottom. Note: If it is set to Allow default access, you must change it by the following steps: Stop your VM and click … Read more

[Solved] Correction the code [closed]

[ad_1] I think you want something like this? <?php if(!empty($_POST[‘D1’]) && !empty($_POST[‘T1’])){ $providers = array( ‘google_drive’ => ‘https://drive.google.com/file/d/{replace}/view’, ‘clody’ => ‘https://www.cloudy.ec/embed.php?id={replace}’ ); if(isset($providers[$_POST[‘D1’]])){ $url = str_replace(‘{replace}’, $_POST[‘T1’], $providers[$_POST[‘D1’]]); echo “Your url is $url”; } } ?> <form method=”POST” action=<?php ($_SERVER[“PHP_SELF”]); ?>> <p>chose url: <select size=”1″ name=”D1″> <option value=”google_drive”>google drive</option> <option value=”clody”>clody</option> </select> <input type=”text” name=”T1″ … Read more

[Solved] how can I get image in special url [closed]

[ad_1] What do you mean by getting an image by that URL? You need to rewrite the URL with htaccess and intercept it somehow using PHP and loading the file from somewhere. Once you have the image you can get any info you want to from it. Rewrite URL with mod_rewrite (i.e.: domain.com/23234234/0 to domain.com?id=23234234&nr=0) … Read more