file-get-contents

need to change codes file_get_contents with cURL code

血红的双手。 提交于 2020-01-30 11:04:21
问题 I need this code done without file_get_contents, because my server doesn't allow to change php.ini . cURL works good. So maybe someone can make it work with cURL ? this is the code i have right now: (A guy once helped me make this and it worked, but now i have new host and it won't let me change allow_url_open) // List of players to fetch data for $players = array('FixAlot','Kringel'); // URL to get statistics from define('LOL_URL', 'http://euw.leagueoflegends.com/ladders/solo-5x5'); // for

need to change codes file_get_contents with cURL code

亡梦爱人 提交于 2020-01-30 11:03:58
问题 I need this code done without file_get_contents, because my server doesn't allow to change php.ini . cURL works good. So maybe someone can make it work with cURL ? this is the code i have right now: (A guy once helped me make this and it worked, but now i have new host and it won't let me change allow_url_open) // List of players to fetch data for $players = array('FixAlot','Kringel'); // URL to get statistics from define('LOL_URL', 'http://euw.leagueoflegends.com/ladders/solo-5x5'); // for

php: file_get_contents() work with CLI, but does not work when called on server (in page)

自古美人都是妖i 提交于 2020-01-29 16:44:05
问题 I am slightly baffled. I am using the bit.ly PHP API to shorten some urls. This works fine on local host - but when I tried it on my server (php running in Apache), file_get_contents() returns an empty string. I checked my apache logs and cannot see any warning/errors by Apache, so I tried the same command at the CL (using PHP CLI): >php -a php > $long_url = some_url_encoded_string; php > echo file_get_contents($long_url); {"errorCode": 0, "errorMessage": "", "results": {"http://www.example

Catching Failed HTTP Request in PHP

流过昼夜 提交于 2020-01-23 14:40:07
问题 So, I'm having a little bit of trouble in PHP with a file_get_contents... I'm using this code. Before, if I ran it with a hash that it could not find (bdfccf20b1db88d835c27685ac39f874), it would return this: fcf1eed8596699624167416a1e7e122e - found: octopus (Google) bed128365216c019988915ed3add75fb - found: passw0rd (Google) d0763edaa9d9bd2a9516280e9044d885 - found: monkey (Google) dfd8c10c1b9b58c8bf102225ae3be9eb - found: 12081977 (Google) ede6b50e7b5826fe48fc1f0fe772c48f - found:

Get contents from a text file and save its values

纵然是瞬间 提交于 2020-01-17 04:25:35
问题 I need to get the contents of a text file called file.txt . The contents of that file are: word1,word 2,word 3 1,another word 1, I have a config.php which includes: $file = "file.txt"; $value = explode(",", $file); And script.php file which will execute other commands based on $value which includes: if (count(explode($value, $chat))>1) { After that, it will execute a command if the $value was detected in $chat . So, I need the $value to be a separate word in file.txt . How can I do this? 回答1:

preg_match_all string from file with value

非 Y 不嫁゛ 提交于 2020-01-16 04:13:28
问题 I need to search into file name lll.php about content of option by value as my file lll.php <option value="n-7069">1</option> <option value="n-7066">3</option> <option value="n-7065">2</option> I try this code but not work with me my search code like n-7065 $ccc2=$rd33fddf33do['contery'] ; my file content value $llll= file_get_contents('lll.php'); but it now work with me preg_match_all('|<option *?</option>|ms', $llll, $matches); foreach ($matches[0] as $select) { preg_match_all('|value='.

Passing variable in a URL (php) & file_get_contents()

蓝咒 提交于 2020-01-15 12:24:51
问题 Is there a way to pass a variable in a URL with file_get_contents() and have file_get_contents() retrieve dynamic content that is based on the value of the variable passed? For example, let's say I have the following code on a page on Website A : $contents=file_get_contents('http://example.com/get.php?a='.$number); echo $contents; where $number is generated on Website A (values can be 1, 2, 3, etc.) Then on example.com , get.php is hosted. Is it possible to retrieve different content from get

Combine an unknown number of .mp3 files

跟風遠走 提交于 2020-01-15 09:18:32
问题 I have this: $number = 1; $mp3 = file_get_contents("http://example.com/text=".$value); $file = md5($value)."-".$number.".mp3"; file_put_contents($file, $mp3); $number++; Result: create abcdef-1.mp3 , abcdef-2.mp3 , abcdef-3.mp3 . Now I want to combine abcdef-1.mp3 with abcdef-2.mp3 and abcdef-3.mp3 . This works: file_put_contents('abcdef.mp3', file_get_contents('abcdef-1.mp3') . file_get_contents('abcdef-2.mp3') . file_get_contents('abcdef-3.mp3')); But is not suitable for my code, because

Combine an unknown number of .mp3 files

二次信任 提交于 2020-01-15 09:17:06
问题 I have this: $number = 1; $mp3 = file_get_contents("http://example.com/text=".$value); $file = md5($value)."-".$number.".mp3"; file_put_contents($file, $mp3); $number++; Result: create abcdef-1.mp3 , abcdef-2.mp3 , abcdef-3.mp3 . Now I want to combine abcdef-1.mp3 with abcdef-2.mp3 and abcdef-3.mp3 . This works: file_put_contents('abcdef.mp3', file_get_contents('abcdef-1.mp3') . file_get_contents('abcdef-2.mp3') . file_get_contents('abcdef-3.mp3')); But is not suitable for my code, because

how to download a file from file_get_contents?

不羁岁月 提交于 2020-01-14 06:49:46
问题 I want to get a file via file_get_contents to copy and rename it and then trigger the download. In other words, a user click a link to a controller, the controller does the business and then return the new file to download. All fine, the only thing I can't do till now is rename and force donwload of the file. 回答1: You can change the headers and echo out the file: // Download the file header('Content-Disposition: attachment; filename="myfile.csv"'); header("Content-Type: text/csv"); header(