This is a discussion on CURL & Regex Help Needed within the General Blogging Chat forums, part of the News and Announcements category; Hey I'm trying to do a little scraper type thing but need a bit of help.. This is my ...
| |||||||
| Members List | Mark Forums Read |
|
#1
| |||
| |||
| Hey I'm trying to do a little scraper type thing but need a bit of help.. This is my code... php Code: function tinyurl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://tinyurl.com/create.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,"url=" . $url . ""); curl_setopt($ch, CURLOPT_HEADER, 0); $result = curl_exec($ch); preg_match('/ (.*?) The problem I have is when I use... php Code: tinyurl($url); The actual tinyurl page gets returned, I know thats the $result = curl_exec($ch); line but $result isn't even being echoed so how can I stop that? Secondly, the regex doesn't work. That's part of the code on the page and within that I want to grab the URL but I can't seem to get it working. Could someone kindly help me fix these errors please, thanks ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |