This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strconv" | |
"strings" | |
) | |
func main() { | |
for i := 1; i <= 100; i++ { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get html dom from string | |
* | |
* @param string $str html domを取得する対象の文字列 | |
* | |
* @param bool $lowercase Force the selectors to all be lowercase. | |
* | |
* @param bool $forceTagsClosed Forcing tags to be closed implies that we don't trust the html, | |
* but it can lead to parsing errors if we SHOULD trust the html. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('classes/simple_html_dom.php'); | |
$str = <<<EOT | |
<html> | |
<head></head> | |
<body>This is a test.</body> | |
</html> | |
EOT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('simple_html_dom.php'); | |
$url = "http://google.co.jp"; | |
$html = file_get_html($url, false, null, 1, -1, true, true, DEFAULT_TARGET_CHARSET, false); | |
echo $html; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
preg_match_all('/hoge/', 'This is a test.', $matches); | |
foreach($matches as $val) { | |
echo "result: " . $val[0] . "\n"; | |
} | |
/***** | |
Output: | |
result: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
preg_match_all('/hoge/', 'This is a test.', $matches); | |
var_dump($matches); | |
preg_match_all('/hoge/', 'This is a test.', $matches, PREG_SET_ORDER); | |
var_dump($matches); | |
/***** | |
Output: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warning: strtotime(): It is not safe to rely on the system's timezone settings. | |
You are *required* to use the date.timezone setting or the date_default_timezone_set() function. | |
In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. | |
We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. | |
in /xxxx.php on line 52 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warning: file_get_contents(http://xxx.co.jp/xxx.jpg): | |
failed to open stream: operation failed in /xxxx.php on line 66 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$proxy = array( | |
'http' => array( | |
'proxy' => 'tcp://127.0.0.1:8080', | |
'request_fulluri' => True, | |
), | |
); | |
$context = stream_context_create($proxy); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$stdin = file_get_contents('php://stdin', 'rb'); | |
preg_match_all('@<img .*?/>@isu' ,$stdin ,$regex, PREG_SET_ORDER); | |
foreach ($regex as $str) { | |
echo $str[0] . PHP_EOL; | |
} | |
?> |