PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 7th, 2012, 03:54 AM
bullex bullex is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 3 bullex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 15 m 32 sec
Reputation Power: 0
PHP-General - How To Grab Content Of Another Site Using Php Culr

Hi Everybody!
I'm new to php programming and have no clue on doing this. I need to create a script to connect to another webshop and get all products from all categories and then save this informations to a database. I have a little script but i dont't know how to continuous.

Quote:
<?php function get_file($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, true); curl_setopt($ch, CURLOPT_TIMEOUT_MS, 44000); $html = curl_exec($ch); curl_close($ch); return $html; } function getPage($html){ $page = 1; if ( preg_match("/<ol><span class=\"pppt\">([0-9]+) products found<\/span>/", $html, $rez) ) { $page = ceil($rez[1] / 100); } elseif ( preg_match("/<ol><span class=\"pppt\">Viewing all ([0-9]+) products<\/span>/", $html, $rez) ) { $page = ceil($rez[1] / 100); } return $page; } $url = "website-url/produs-"; echo get_file($url); function getColcode($html){ if ( preg_match_all('`website-url/images/products/([0-9]{8})_.*.jpg`Usi', $html, $rez) ) { return $rez[1]; } return false; } ?>

Reply With Quote
  #2  
Old December 7th, 2012, 05:16 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,879 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 7 h 26 m 51 sec
Reputation Power: 813
Hi,

well, what are we supposed to do with that code snippet? We don't know your "other site".

Reply With Quote
  #3  
Old December 8th, 2012, 10:48 PM
cdcaveman cdcaveman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Location: Florida
Posts: 6 cdcaveman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 31 sec
Reputation Power: 0
did you ask the other site if they had a xml file you could reference instead of scraping their site?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP-General - How To Grab Content Of Another Site Using Php Culr

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap