Προς το περιεχόμενο

Προτεινόμενες αναρτήσεις

Δημοσ.

Καλησπέρα,

 

θέλω μέσα από μια PHP να κάνω post στο blog που έχω.

 

Προσπαθώ μάταια από το πρωί, στηριζόμενος στον google.

 

Έχει κανείς ανάλογη εμπειρία;

Δημοσ.

Καλημέρα,

απότι κατάλαβα θέλεις να κάνεις ανάρτηση άρθρου στο blogger από το Server σου με PHP.

Στέλνεις ένα e-mail , τη διεύθυνση στη δίνει το blogger, το άρθρο και το blogger το κάνει αυτόματα ανάρτηση στο blog σου.

Το e-mail το στέλνεις μέσω php από το server σου.

 

Περισσότερες πληροφορίες μπορείς να βρεις εδώ: https://support.google.com/blogger/answer/41452?hl=en

Δημοσ.

Με curl μπορεις χρησιμοποιώντας το Link.png Site: Atom XML-based API  του blogger.

<?php
/*

POST TO BLOGGER USING PHP AND CURL

You need to know the blogid of the blog you want to post to.
To get the blogid, go to blogger.com and log in to your blogger account.
There will be a list of blogs.
When you click on a blog name, it will go to a url like :
http://www.blogger.com/posts.g?blogID=1234567

The blogID portion is what you use for your $blog_id
- in the above example it is 1234567

To carry out other blogger tasks, refer to the Atom API Documentation for
Blogger: http://code.blogger.com/archives/atom-docs.html#authentication
*/

// Set the date of your post
$issued=gmdate("Y-m-d\TH:i:s\Z", time());

// Set the title of your post
$title="TEST ATOM API POST";

// Set the body text of your post.
$body="This is a test post, sent using the atom api.";

// This needs to be changed to the blogID of the blog
// you want to post to (as discussed at the top of this script)
$blog_id="1234567";

// You must know your username and password
// to be able to post to your blog.
$your_username="username";  //change this to your blogger login username
$your_password="password";  // change this to your blogger login password

// This is the xml message that contains the information you are posting
// to your blog
$content = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\r\n"
   . "<entry xmlns='http://purl.org/atom/ns#'>\r\n"
   . "<title mode='escaped' type='text/plain'>".$title."</title>\r\n"
   . "<issued>".$issued."</issued>\r\n"
   . "<generator url='http://www.yoursitesurlhere.com'>Your client's name
here.</generator>\r\n"
   . "<content type='application/xhtml+xml'>\r\n"
   . "<div xmlns='http://www.w3.org/1999/xhtml'>".$body."</div>\r\n"
   . "</content>\r\n"
   . "</entry>\r\n";

// This is the custom header that needs to be sent to post to your blog.
$headers  =  array( "Content-type: application/atom+xml" );

// Use curl to post to your blog.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.blogger.com/atom/".$blog_id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERPWD, $your_username.':'.$your_password);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);

$data = curl_exec($ch);

if (curl_errno($ch)) {
 print curl_error($ch);
} else {
 curl_close($ch);
}

// $data contains the result of the post...
echo $data;

?>

Περισσότερα εδω: http://curl.haxx.se/libcurl/php/examples/blogpost.html

Δημοσ.

@exarhis

Δεν βρήκα άκρη με το email που λες

 

@vacilis

Το είχα χρησιμοποιήσει το συγκεκριμένο αλλά μου βγάζει ένα error

SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Από ότι κοίταγα, είναι αρκετά παλιός ο συγκεκριμένος τρόπος. Το link που μου έστειλες είναι του 06'.

 

Ευχαριστώ και τους 2 για τις απαντήσεις και τον χρόνο σας.

 

Η λύση είναι Link.png Site: εδώ αλλά δεν μπορώ να το φτιάξω.

Ουσιαστικά κολλάω στο σημείο που λέει "You must be authenticated to create a post."

Δημοσ.

 

 

@vacilis

Το είχα χρησιμοποιήσει το συγκεκριμένο αλλά μου βγάζει ένα error

SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Χρησιμοποιείς Windows? Τσεκαρε εδω: http://stackoverflow.com/a/16495053

Δημιουργήστε ένα λογαριασμό ή συνδεθείτε για να σχολιάσετε

Πρέπει να είστε μέλος για να αφήσετε σχόλιο

Δημιουργία λογαριασμού

Εγγραφείτε με νέο λογαριασμό στην κοινότητα μας. Είναι πανεύκολο!

Δημιουργία νέου λογαριασμού

Σύνδεση

Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ.

Συνδεθείτε τώρα
  • Δημιουργία νέου...