cURLを使用してログインページを過ぎてウェブサイトから収入を得ようとしています。私はこれがちょっとした方法だと知っていますが、私は選択がありません。PHP cURLによるウェブサイトからの収入
<?php
$username = "example";
$password = "example";
$postfields = "email=$username&password=$password";
// Use Curl to return the raw source of a webpage to a variable called
$ch = curl_init();
//curl_setopt($ch, CURLOPT_HEADER, 1); // Get the header
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Allow redirection
curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookie");
curl_setopt($ch, CURLOPT_URL, "https://www.domain.com/login");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$postfields");
$page = curl_exec($ch);
curl_close($ch); // Closing
if (preg_match("/<th>(.*)<\/th/s", $page, $matches)) {
echo $matches[1];
}
?>
それだけで、基本的に私は過去のログイン罰金を取得することができていますし、それが何かをつかむしないするpreg_matchを使用しようとすると、それは、しかし、私は収入をつかむしようとしています特定のWebサイトのダッシュボードに私をリダイレクトしますダッシュボードのすべてのHTMLを出力します。私は大歓迎
<th>$99.99</th>
ヘルプ以内に "$ 99.99" 取得しようとしています
。
それはそうした。ありがとうございました! – Ziygo