karabey
01-13-2012, 04:37 AM
Hi,
I am trying to get from the link which is XML some text to convert into link or drop down list. But somehow it will not work :(
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://itunes.com/version?touchUpdate=true");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
//links
if(preg_match_all("~(.*)/iPhone/(.*)4\.0(.*)Restore", $result, $links))
{
foreach($links[0] as $link)
{
echo $link."<br />";
}
}
The XML Source File shows this
<key>iPhone2,1</key>
<dict>
<key>7A341</key>
<dict>
<key>OfferPartialRestoreAsUpdate</key>
<true/>
<key>Restore</key>
<dict>
<key>BuildVersion</key>
<string>7E18</string>
<key>DocumentationURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7822.20100202.VfP8u/iPhoneDocumentation_3.1.3.ipd</string>
<key>FirmwareURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7472.20100202.8tugj/iPhone2,1_3.1.3_7E18_Restore.ipsw</string>
<key>ProductVersion</key>
<string>3.1.3</string>
</dict>
</dict>
<key>7A400</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7C106c</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7C116a</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7C144</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7D11</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7E18</key>
<dict>
<key>Restore</key>
<dict>
<key>BuildVersion</key>
<string>7E18</string>
<key>DocumentationURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7822.20100202.VfP8u/iPhoneDocumentation_3.1.3.ipd</string>
<key>FirmwareURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7472.20100202.8tugj/iPhone2,1_3.1.3_7E18_Restore.ipsw</string>
<key>ProductVersion</key>
<string>3.1.3</string>
</dict>
</dict>
<key>Unknown</key>
<dict>
<key>Universal</key>
<dict>
<key>Restore</key>
<dict>
<key>BuildVersion</key>
<string>7E18</string>
<key>DocumentationURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7822.20100202.VfP8u/iPhoneDocumentation_3.1.3.ipd</string>
<key>FirmwareURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7472.20100202.8tugj/iPhone2,1_3.1.3_7E18_Restore.ipsw</string>
<key>ProductVersion</key>
<string>3.1.3</string>
<key>EpochVersion</key>
<string>2</string>
</dict>
</dict>
</dict>
</dict>
The Text i want to get is
<key>iPhone2,1</key>
and
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7472.20100202.8tugj/iPhone2,1_3.1.3_7E18_Restore.ipsw</string>
New some advice how i can do that.. Thanks
I am trying to get from the link which is XML some text to convert into link or drop down list. But somehow it will not work :(
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://itunes.com/version?touchUpdate=true");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
//links
if(preg_match_all("~(.*)/iPhone/(.*)4\.0(.*)Restore", $result, $links))
{
foreach($links[0] as $link)
{
echo $link."<br />";
}
}
The XML Source File shows this
<key>iPhone2,1</key>
<dict>
<key>7A341</key>
<dict>
<key>OfferPartialRestoreAsUpdate</key>
<true/>
<key>Restore</key>
<dict>
<key>BuildVersion</key>
<string>7E18</string>
<key>DocumentationURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7822.20100202.VfP8u/iPhoneDocumentation_3.1.3.ipd</string>
<key>FirmwareURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7472.20100202.8tugj/iPhone2,1_3.1.3_7E18_Restore.ipsw</string>
<key>ProductVersion</key>
<string>3.1.3</string>
</dict>
</dict>
<key>7A400</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7C106c</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7C116a</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7C144</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7D11</key>
<dict>
<key>SameAs</key>
<string>7A341</string>
</dict>
<key>7E18</key>
<dict>
<key>Restore</key>
<dict>
<key>BuildVersion</key>
<string>7E18</string>
<key>DocumentationURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7822.20100202.VfP8u/iPhoneDocumentation_3.1.3.ipd</string>
<key>FirmwareURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7472.20100202.8tugj/iPhone2,1_3.1.3_7E18_Restore.ipsw</string>
<key>ProductVersion</key>
<string>3.1.3</string>
</dict>
</dict>
<key>Unknown</key>
<dict>
<key>Universal</key>
<dict>
<key>Restore</key>
<dict>
<key>BuildVersion</key>
<string>7E18</string>
<key>DocumentationURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7822.20100202.VfP8u/iPhoneDocumentation_3.1.3.ipd</string>
<key>FirmwareURL</key>
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7472.20100202.8tugj/iPhone2,1_3.1.3_7E18_Restore.ipsw</string>
<key>ProductVersion</key>
<string>3.1.3</string>
<key>EpochVersion</key>
<string>2</string>
</dict>
</dict>
</dict>
</dict>
The Text i want to get is
<key>iPhone2,1</key>
and
<string>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7472.20100202.8tugj/iPhone2,1_3.1.3_7E18_Restore.ipsw</string>
New some advice how i can do that.. Thanks