2012-04-24 7 views
0

電話番号の一部を解析しようとしていますfrom a websiteウェブサイトからの電話番号の解析

私はcURLでソースコードを取得していますが、コードの半分しか戻っていませんが、欠けている部分はまさに私が必要なものです。このことは私を悩ませ続けている。

これまでの私のコード:

$ch = curl_init("http://www.baroul-bucuresti.ro/index.php?w=definitivi&l=C&p=2"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 
$content = curl_exec($ch); 
curl_close($ch); 
print_r ($content); 

答えて

2

私は問題は、問題のURLが別の場所にリダイレクトすることで302を持っていることだと思う:

$ telnet www.baroul-bucuresti.ro 80 
Trying 91.208.179.20... 
Connected to www.baroul-bucuresti.ro. 
Escape character is '^]'. 
GET /index.php?w=definitivi&l=C&p=2 HTTP/1.1 
host: www.baroul-bucuresti.ro 

HTTP/1.1 302 Found 
Date: Fri, 27 Apr 2012 20:24:54 GMT 
Server: Apache/2.2.15 (CentOS) 
X-Powered-By: PHP/5.3.3 
Set-Cookie: PHPSESSID=qjbqvveqtmarv7o0f820bbeq71; path=/ 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache 
Set-Cookie: for_tablou=1 
Set-Cookie: bvbsessionhash=b9c609e162dab90fc86c1fdb52e07fdd; expires=Sun, 27-May-2012 20:24:57 GMT; path=/ 
Set-Cookie: bvblastvisit=1335558297; expires=Sun, 27-May-2012 20:24:57 GMT; path=/ 
Set-Cookie: bvblastactivity=1335558297; expires=Sun, 27-May-2012 20:24:57 GMT; path=/ 
Set-Cookie: bvbuserid=deleted; expires=Thu, 28-Apr-2011 20:24:56 GMT; path=/ 
Set-Cookie: for_tablou=1 
Location: /tablou 

私はあなたを変更しましたこのオプションをカールに追加することでコード:

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 

そして今、完全な内容を取得しているようです。あなたは望みますが、それは実際の場所の完全な内容を取得します、それを試してみることができますか?