こんにちは。ユーザーを取得して Form から渡す単純な Web ページを作成し、CURL を使用してこれらの変数を別のページに投稿してログインし、結果を表示します (ここから始めて、別のページにアクセスすることにしました)。問題は、サイトのコンテンツの一部が動的に読み込まれることです (ウィジェット)。そのため、結果を取得すると、サイトのフレームが読み込まれますが、ウィジェットはレンダリングされません。2 番目のサイトからウィジェットをロードする際のエラー: "ptBaseURI = String(location).match(//ps(c ... ") これはセッションの問題でしょうか?私の php コード:
$post_data['pwd']=$_REQUEST['password'];
foreach ($post_data as $key => $value){
$post_items[]=$key . '=' . $value;
}
$post_string = implode ('&',$post_items);
$tmp_file_name=tempnam("/tmp/","COOKIE");
$curl_handle=curl_init('www.targetsite.com/...');
curl_setopt($curl_handle, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
//curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_handle, CURLOPT_COOKIEJAR,$tmp_file_name);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER,true);
//curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $post_string);
$result = curl_exec($curl_handle);
$curl_handle=curl_init('www.targetsite.com/...');
curl_setopt($curl_handle, CURLOPT_COOKIEFILE,$tmp_file_name);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl_handle, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $post_string);
$result = curl_exec($curl_handle);
$cArray = curl_getinfo($curl_handle);
$newURL = $cArray[url];
echo str_replace('</head>','<base href="'.$newURL.'" /></head>',$result);