Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I save "example.mp4" from $url="http://videos.com/example.mp4" as "56.mp4" using a variable $id=56 to /videos
mkdir('/videos');
file_put_contents("/videos/" . ((string) $id) . ".mp4", file_get_contents($url));
Documentation:
http://php.net/manual/en/function.file-get-contents.php
http://php.net/manual/en/function.file-put-contents.php
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
i have this string
$string = "Social\Notify\Models\User";
How can i tell to php how select just the fourth segment of it? in this case just the word User?
Something like this will do?
$str='Social\Notify\Models\User';
echo explode('\\',$str)[3]; //"prints" User
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm making a file creating script in php using file_put_contents, so how do you place a file to the directory below?
For example the script is in localhost:8080/favicon/ and I want to place the file in localhost:8080, how can this be done?
$dest = __DIR__ . '/../filename';
file_put_contents($dest, $data);
See http://php.net/manual/language.constants.predefined.php
fclose(fopen(path_to_your_file_like_C:\abc\,"a"));
for more info go here.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I parse this txt file or how could i turn it into xml(if it's possible)?
Help please.
Edit: Yes, that is not a json.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am getting following response
{"success":true,"error":false,"code":"SJKUT3GR"}
I just want to print SJKUT3GR from above.
anyone knows how to do this?
$data = json_decode($response);
echo $data->code;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have the following string formats: "$ 3.20" or "$ 10.34". I want to verify with preg_match if the string is exactly this type of a format.
Any suggestions are appreciated?
Try this pattern:
if (preg_match('/\$\s[\d]+\.[\d]{2}/', $text)){
//do something
}