Created
March 11, 2021 05:15
-
-
Save dev-w3/81c711466d64d27eee74035a032bd0a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$curl = curl_init('https://www.domain.com/outwell/posadas-foldaway-bed-single'); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); | |
curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); | |
$page = curl_exec($curl); | |
$related_products = array(); | |
// Get Content Inside of productdetail_lblProductName Div/ Regex Match | |
$regex = '/<div id="productdetail_lblProductName">(.*?)<\/div>/s'; | |
if ( preg_match($regex, $page, $list) ) | |
echo $list[1]; | |
else | |
print "Not found"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#Data Scrapping using cURL / Regex