need experts help like something else or software-freak

Started on the old forum in March 2012 · view the original in the archive · old links redirect here

31 replies · 1,502 views · started 14 years ago · 1 min read

7 participants
Lue_chin Developer · 107 posts #1

hello i try to make a grabber but its not working its code

<?php

$site_url = 'http://smsming.com/cat/April-Fools-Day-Sms.html';

$ch = curl_init();

$timeout = 5; // set to zero for no timeout

curl_setopt ($ch, CURLOPT_URL, $site_url);

curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

ob_start();
curl_exec($ch);
curl_close($ch);

$file = ob_get_contents();

ob_end_clean();
 function pick($start,$stop,$from){
$from=explode($start,$from);
$from=explode($stop,$from[1]);
$from=$from[0];
return $from;
}

$linksource=pick('<div class="pendu">','...</a> <br>',$file);
$page=str_replace('href="/cat/','href="?cat=',$linksource);

$chunk = explode('<div class="sms">', $page); 
//print_r($chunk); 
$count = count($chunk); 
for ($i=1; $i < $count; $i++)  
{ 
    
$match_name = preg_match('/sms:?body=(.*)">/i', $chunk[$i], $link); 

echo "link=:$link[1]<br>";
} 
echo "<hr>";

?>

now i explain what i wanti want that all sms which is in page showing like sms and then sms share + forum link that the any copy with one click please help me i want this grabber like this i give you demo http://fbcomments.tk/status please help me i try so hard but not working

something else Fellow · 2,296 posts #5

needs preg replace

"..." these are different symbol to yours copy and paste from source 😛

added after null seconds...

this might help:

<?php  
//Scripted by Lue Chin improved by something else on coding-talk.com forums :P
////////////Settings 
$sitename = 'Something else :P'; 
$site_url = 'http://smsming.com/cat/April-Fools-Day-Sms.html';  
$logo = 'image/logo.gif';   
$userAgent = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16' ;  
$ip = '124.83.49.19'; 
$language = 'en-us,en;q=0.7,de-de;q=0.3'; 
$accept = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'; 
$timeout = 5; // set to zero for no timeout  

////////////CURL 
$ch = curl_init();  
curl_setopt($ch, CURLOPT_URL, $site_url);  
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);    
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);  
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: '.$language,'Accept: '.$accept,'X-Forwarded-For: '.$ip)); 
ob_start();  
curl_exec($ch);  
curl_close($ch);  
$file = ob_get_contents();  
ob_end_clean();  

////////////function pick Start,stop,source 
function pick($start,$stop,$from){  
$from=explode($start,$from);  
$from=explode($stop,$from[1]);  
$from=$from[0];  
return $from;  
}  

$linksource = pick('<div class="pendu">','...</a> <br>',$file);  //make sure you change dots to ones in source
////////////Last Min String Replacements  
$page = str_replace('href="/cat/','href="?cat=',$linksource);  
$page = str_replace('SMS (smsming.com)',$sitename,$page);  

echo $logo+'<br/>'+$page; 

/* 
////////////errrr what you trying to do here? 
$chunk = explode('<div class="sms">', $page);   
//print_r($chunk);   
$count = count($chunk);   
for ($i=1; $i < $count; $i++)    
{   
     $match_name = preg_match('/sms:?body=(.*)">/i', $chunk[$i], $link);  
     echo "link=:$link[1]<br>";  
     echo "<hr>";  
}   
////////////maybe you should use: 
//////////// $page = preg_replace('/sms:?body=(.*?)">/is','sms:?body=$1'"><br/><textarea>$1</textarea>',$page); 
//////////// or something similar  
*/ 
?>
softwarefreak Senior · 349 posts #7

I'd have helped if you opened the thread like "need experts help like software-freak or something else":P :LOL joking....

BTW,I'm really not getting...be specific,so dat we can help you 🙂

Added after 3 minutes:

Lue_chin wrote: Dear master you are not under stand i want to add a count code in the grabber because i paste a sms 2 time in grabber please make this like this link http://fbcomments.tk/status

you want 2 messages per page,ryt?

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

just_m3. Developer · 199 posts #8

Lue_chin wrote: Dear master you are not under stand i want to add a count code in the grabber because i paste a sms 2 time in grabber please make this like this link http://fbcomments.tk/status

You gonna need this http://coding-talk.com/f16/small-grabber-demo-based-on-oop-16633/

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<title>Here is my link grabber demo</title> 

<style type="text/css">
body{
margin: 3px auto; 
font-family : Verdana, arial; 
font-weight : normal; 
font-size : small; 
color : #333333; 
background-color : #ffffff; 
}

.sms-title {
	padding-bottom : 2px;
	padding-top : 2px;
	background : #FFF;
	padding-left:4px;
	border: 1px solid #CCCCCC;
} 
.sms-body{padding-left:5px;margin-left:5px;
}

.sms-body-cont {
	padding-bottom : 2px;
	padding-top : 2px;
	background : #FFF;
	padding-left:4px;
	border: 1px solid #CCCCCC;
} 
</style></head>

<body> 
<?php 
############################### 
require_once'grab_lib.php';   # 
############################### 

function fetch_sms_content($opp){
foreach($opp as $value){

$moddmysms = '<!--- From here -->'.$value.'<!-- To here -->';

$moddmysms = preg_replace('/<!--- From here --><\!DOCTYPE(.*?)<!-- To here -->/is','',$moddmysms);  

preg_match_all( "#<!--- From here -->(?P<extracted>.+?)<!-- To here -->#sim",$moddmysms, $show ) ;

$moddmysms = preg_replace('/<\/div><hr>(.*?)<\/html>/is','',$show['extracted'][0]);  

$moddmysms=str_replace("Smsming.com",$_SERVER['HTTP_HOST'],$moddmysms);

preg_match_all( "#<div class=\"sms-body\"><br>(?P<textareacontent>.+?)<a href=\"sms:#sim",$moddmysms, $my ) ;

$textarea=str_replace("<br>","\n",$my['textareacontent'][0]);
$textarea=str_replace("\n\n\n\n","\n",$textarea);

$retthis="".$moddmysms."<textarea name=\"copy\" cols=\"20\" rows=\"6\">".$textarea."</textarea><br><br>\n\n\n";

// doin' this because first result is empty
$retthis = str_replace('<textarea name="copy" cols="20" rows="6"></textarea><br><br>','',$retthis);

echo $retthis; }}

$grab = new grabber(); 

$moddmydata = $grab->page('http://smsming.com/cat/April-Fools-Day-Sms.html','fget'); 

$moddmydata = preg_replace('/<div class="dark">(.*?)<\/div><div class="sms">/i','<div class="sms-body-cont"><div class="sms-title">$1</div><div class="sms-body"><br>',$moddmydata);

$opp=explode('<div class="sms-body-cont">',$moddmydata);

fetch_sms_content($opp);

?> 

</body> 
</html>

Got it buddy 🙂 hit tnx button if this is what you've bein' looking for ...

  1. hell ya i rock ! 💃

Preview here 🙂

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Attachments: preview.png
softwarefreak Senior · 349 posts #9

My small edit of something's script 😀

<?php

//Scripted by Lue Chin improved by something else on coding-talk.com forums :P 
////////////Settings  
$sitename = 'Something else :P';  
$site_url = 'http://smsming.com/cat/April-Fools-Day-Sms.html';   
$logo = 'image/logo.gif';    
$userAgent = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16' ;   
$ip = '124.83.49.19';  
$language = 'en-us,en;q=0.7,de-de;q=0.3';  
$accept = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';  
$timeout = 0; // set to zero for no timeout   

////////////CURL  
$ch = curl_init();   
curl_setopt($ch, CURLOPT_URL, $site_url);   
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);     
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);   
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: '.$language,'Accept: '.$accept,'X-Forwarded-For: '.$ip));  
  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);   
  
$file = curl_exec($ch);   
curl_close($ch); 
//echo $file;
$file = preg_replace('/<!DOCTYPE html(.*)<\/head>/is', '', $file);
$file = preg_replace('/<a href="\/index.html">(.*)<\/html>/is', '', $file);
$dark = explode('<div class="dark">', $file);
$sms = explode('<div class="sms">', $file);
//print_r($dark);
for ($i=1; $i < count($dark); $i++)
 { 
	$header = strstr($dark[$i], '</div><div class="sms">', true);
	$body = strstr($sms[$i], '<a href="sms:?', TRUE);
	echo "<div class='some'>$header<br />$body<br />
	<textarea>".trim(strip_tags($body))."</textarea></div>";
	
}
 
?>

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

just_m3. Developer · 199 posts #11

Lue_chin wrote: first of all i thanks to all who reply specialy soft freak please chk its not working http://fbcomments.tk/status/sms.php not working

Don't know about you but http://down.unick.info/ it works ...

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

softwarefreak Senior · 349 posts #12

Lue_chin wrote: first of all i thanks to all who reply specialy soft freak please chk its not working http://fbcomments.tk/status/sms.php not working

oops, you PHP version is lesser dan 5.3.0, the 3rd param for strstr() is not supported in lower versions,wait let me change

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

something else Fellow · 2,296 posts #15
<?php 

//Scripted by Lue Chin improved by something else and improved by softwarefreak on coding-talk.com forums :P  
////////////Settings   
$sitename = 'Sitename';   
$site_url = 'http://smsming.com/cat/April-Fools-Day-Sms.html';    
$logo = 'image/logo.gif';     
$userAgent = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16' ;    
$ip = '124.83.49.19';   
$language = 'en-us,en;q=0.7,de-de;q=0.3';   
$accept = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';   
$timeout = 0; // set to zero for no timeout    

////////////CURL   
$ch = curl_init();    
curl_setopt($ch, CURLOPT_URL, $site_url);    
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);      
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);    
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: '.$language,'Accept: '.$accept,'X-Forwarded-For: '.$ip));   
   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);    
   
$file = curl_exec($ch);    
curl_close($ch);  
//echo $file; 
$file = preg_replace('/<!DOCTYPE html(.*)<\/head>/is', '', $file); 
$file = preg_replace('/<a href="\/index.html">(.*)<\/html>/is', '', $file); 
$dark = explode('<div class="dark">', $file); 
$sms = explode('<div class="sms">', $file); 
//print_r($dark); 
$totalsections = floor(count($dark)/2);
if(isset($_GET['page'])) $i = (int) $_GET['page']; else $_GET['page'] = 1;
if($i=="" || $i = null || $i = 0) $i= 1;
$j = $i;
for (; $i < $j+2; $i++) 
 {  
    $header = strstr($dark[$i], '</div><div class="sms">', true); 
    $body = strstr($sms[$i], '<a href="sms:?', TRUE); 
    echo "<div class='some'>$header<br />$body<br /> 
    <textarea>".trim(strip_tags($body))."</textarea></div>"; 
     
} 
  echo '<a href="?page=1">1</a>';
$page = $_GET['page'];
if($totalsections>1&&$page<=$totalsections)
 {
    echo '<a  href="?page='+($page+1)+'">'+($page+1)+'</a>';
 }
?>
softwarefreak Senior · 349 posts #17

something else wrote:

<?php 

//Scripted by Lue Chin improved by something else and improved by softwarefreak on coding-talk.com forums :P  
////////////Settings   
$sitename = 'Something else :P';   
$site_url = 'http://smsming.com/cat/April-Fools-Day-Sms.html';    
$logo = 'image/logo.gif';     
$userAgent = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16' ;    
$ip = '124.83.49.19';   
$language = 'en-us,en;q=0.7,de-de;q=0.3';   
$accept = 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5';   
$timeout = 0; // set to zero for no timeout    



////////////CURL   
$ch = curl_init();    
curl_setopt($ch, CURLOPT_URL, $site_url);    
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);      
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);    
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: '.$language,'Accept: '.$accept,'X-Forwarded-For: '.$ip));   
   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);    
   
$file = curl_exec($ch);    
curl_close($ch);  
//echo $file; 
$file = preg_replace('/<!DOCTYPE html(.*)<\/head>/is', '', $file); 
$file = preg_replace('/<a href="\/index.html">(.*)<\/html>/is', '', $file); 
$dark = explode('<div class="dark">', $file); 
$sms = explode('<div class="sms">', $file); 
//print_r($dark); 
$totalsections = floor(count($dark)/2);
if(isset($_GET['page'])) $i = (int) $_GET['page']; else $_GET['page'] = 1;
if($i=="" || $i = null || $i = 0) $i= 1;
$j = $i;
for (; $i < $j+2; $i++) 
 {  
    $header = strstr($dark[$i], '</div><div class="sms">', true); 
    $body = strstr($sms[$i], '<a href="sms:?', TRUE); 
    echo "<div class='some'>$header<br />$body<br /> 
    <textarea>".trim(strip_tags($body))."</textarea></div>"; 
     
} 
  echo '<a href="?page=1">1</a>';
$page = $_GET['page'];
if($totalsections>1&&$page<=$totalsections)
 {
    echo '<a  href="?page='+($page+1)+'">'+($page+1)+'</a>';
 }
?>

unfair LOL

$sitename = 'Something else :P';

BTW, setting a timeout while making a grabber is not a gud idea,A blank page is retured w/ a curl error it exceeds the time :S it's better the script reaches max execution time & dies to a fatal error,this is wat I've noticed,may be I'm wrong...🤷

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

m4ster_v4 Developer · 125 posts #19
<?php
function imnoob($u=0){
if($u==0){
$url = "http://smsming.com/cat/April-Fools-Day-Sms.html";
}else{
$url = "http://smsming.com/cat/April-Fools-Day-Sms/$u.html";
}
$userAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1";
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_USERAGENT,$userAgent);
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_AUTOREFERER,true);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_TIMEOUT,60000);  
    $html  = curl_exec($ch);
   

$pieces = explode('<a href="sms:?body=', $html);
$count = count($pieces); 
for ($i=1; $i < $count; $i++)  { 
   
$pieces2 = explode('"><font color="brown">', $pieces[$i]);
$text = str_replace("<br>",chr(13),$pieces2[0]);
$text = str_replace("-Smsming.com","- m4ster_v4",$text);
if($u==0){
echo "<div style=\"padding-top:3px;padding-bottom:3px;padding-left:5px;border:1px;border-style:solid;border-color:#e2c822;background-color:#fff9d7;margin-bottom:5px;color:#000\">";
echo "<textarea type='text' readonly>$text</textarea>";
echo "</div>";
}else{
echo "<div style=\"padding-top:3px;padding-bottom:3px;padding-left:5px;border:1px;border-style:solid;border-color:#e2c822;background-color:#fff9d7;margin-bottom:5px;color:#000\">";
echo "<textarea type='text' readonly>$text</textarea>";
echo "</div>";
}

}
}

imnoob(0);
$count = 20; //CHANGE TO PAGE VALUE
for ($i=10; $i < $count; $i++)  { 
imnoob($i);
}

?>

Visit my WEBSITE Project: http://www.aspirewap.net

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close